limitation not taken into account

HEY, I am rather new in using matlab and I have a problem I cannot understand, I have the following limitation:
if (x_range(k)>y_range(l)) | (x_range(k)>z_range(j)) | (z_range(j)>y_range(l))
funM(k,l,j)=Inf;
I tried both funM(k,l,j)=Inf; and funM(k,l,j)=NaN;
The problem is that after I run it the result I get sometimes is z_range(j)>y_range(l). I cannot understand why it does not take into account my limitation. Any suggestions??

답변 (2개)

Walter Roberson
Walter Roberson 2013년 3월 6일

0 개 추천

You do not change z_range or y_range in this code, so if z_range(j) > y_range(l) here then it will continue to be true afterwards.
chrysoula
chrysoula 2013년 3월 6일

0 개 추천

The thing is that after that limitation I try to minimize the function funM(k,l,j) and then I ask matlab to give me the x_range,y_range,z_range for the minimum of funM. How can it give me a minimum of the function with z>y since it is in there is this limitation?????

댓글 수: 2

Walter Roberson
Walter Roberson 2013년 3월 6일
How are you doing the minimization? It might be possible to put in a constraint
chrysoula
chrysoula 2013년 3월 7일
편집: Walter Roberson 2013년 3월 7일
this is my limitation:
if (x_range(k)>y_range(l)) | (x_range(k)>z_range(j)) | (z_range(j)>y_range(l)) funM(k,l,j)=Inf;
and then to minimise:
for k=2:(n3-1) for l=2:(n4-1) for j=2:(n5-1) if (funM(k,l,j)<Inf) if (funM(k-1,l,j)>funM(k,l,j)) && .......... && (funM(k+1,l+1,j+1)>funM(k,l,j)) minimum(i)=funM(k,l,j); i=i+1; end end end end
Then i get the x_range, y_range, z_range for the minimum of funM and many time z_range>y_range, why is this happening????
thank you very much for your help

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

카테고리

도움말 센터File Exchange에서 MATLAB Data API for C++에 대해 자세히 알아보기

질문:

2013년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by