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 个评论

How are you doing the minimization? It might be possible to put in a constraint
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++ 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by