Matt J
Posts:
4,997
Registered:
11/28/09


Re: how to plot a function subject to constraints.
Posted:
Jan 7, 2013 11:05 AM


"Emrah " <superonline21@hotmail.com> wrote in message <kceqns$k86$1@newscl01ah.mathworks.com>... > > Make that > > > > infeasible=~all(G(:)<=0); > > > > > > > > > > Error using horzcat > > > CAT arguments dimensions are not consistent. > > > > > > Error in fplot2 (line 8) > > > G=[g1,g2,g3,g4,g5,g6,g7]; > > > > > > any idea? > > ============== > > > > Nope. Don't you expect all g1....g7 to be the same size? If not, it should be obvious to you why it might not be possible to concatenate them. If so, did you check what sizes they are? What happens when use DBSTOP to pause execution at line 8 and do > > "whos g*" > > I seperated them and solved it. but still returns empty :( > > %calculating constraints > [g1,g2,g3,g4,g5,g6,g7]=constraints(x1,x2,x3,x4); > G1=[g1,g2,g4,g6,g7]; > G2=[g3,g5]; > infeasible=~all(G1(:)<=0)+all(G2(:)<=0); ===============
Whoops. Make that
infeasible=~all(G1(:)<=0)  ~all(G2(:)<=0);
Also, leave x2,x3 alone. Instead, do
f=1.10471.*x1^2.*x2+0.04811.*x3.*x4.*(14.0+x2); f(infeasible)=nan;
> %constraints are applied to f(x) > f=f*mod_neg_step(g1)*mod_neg_step(g2)*mod_neg_step(g3)*mod_neg_step(g4)... > *mod_neg_step(g5)*mod_neg_step(g6)*mod_neg_step(g7); =============
No idea what this is for. I think it should be unnecessary with the above.

