how to find the next minimum value using if..else only?

let the given values are, b1(k)=195, b1(k+1)=190,and p1(k)=204,p1(k+1)=187,
p11(k)=220,p111(k)=188,p11(k+1)=203,p111(k+1)=171.
I need to find the optimal value of p1(k) and p1(k+1).
suppose,
ax= abs(b1(k)-p1(k)) + abs(b1(k+1)-p11(k+1))= 22
bx= abs(b1(k)-p1(k)) + abs(b1(k+1)-p111(k+1))=28
cx= abs(b1(k)-p11(k)) + abs(b1(k+1)-p1(k+1))=28
dx= abs(b1(k)-p11(k)) + abs(b1(k+1)-p11(k+1))=55
ex= abs(b1(k)-p11(k)) + abs(b1(k+1)-p111(k+1))=44
fx=abs(b1(k)-p111(k)) + abs(b1(k+1)-p1(k+1))=10
gx=abs(b1(k)-p111(k)) + abs(b1(k+1)-p11(k+1))=20
hx=abs(b1(k)-p111(k)) + abs(b1(k+1)-p111(k+1))=26
I need to find the optimal value of p1(k) and p1(k+1) out of available 8 combinations with 3 conditions. The 8 combinations are
1. p1(k),p11(k+1)
2. p1(k),p111(K+1)
3. p11(k),p1(k+1)
4. p11(k),p11(k+1)
6. p11(k),p111(k+1)
7. p111(k),p1(k+1)
8. p111(k),p11(k+1)
9. p111(k),p111(k+1).
and the 3 conditions are
1. The absolute difference between p1(k),p1(k+1) must be between 0 to 15.
2. Any one value out of p1(k) or p1(k+1) must be greater than 192.
3. I should consider first the minimum value among 'ax' to 'hx'
The actual probelem i am facing is, when i choose the smallest value 'fx'=10 then its corresponding values are p1(k)=p111(k)=188 and
p1(k+1)=p1(k+1)=187 ,,,here both the values are less than 192.i dont know how to check for the next lowest value i.e 'gx'=20.

댓글 수: 2

Why the restriction that you can only use if/else in your code? Don't you just want to solve the problem no matter how? Why limit yourself?
Dear sir, it is also ok by using any techhnique.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2017년 5월 16일

댓글:

2017년 5월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by