Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: how to plot a function subject to constraints.
Replies: 14   Last Post: Jan 7, 2013 1:15 PM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Emrah Posts: 8 Registered: 12/30/12
Re: how to plot a function subject to constraints.
Posted: Jan 7, 2013 10:33 AM
 Plain Text Reply

"Matt J" wrote in message <kcenvl\$95v\$1@newscl01ah.mathworks.com>...

> Set x2 and x3 to NaN where the constraints are not satisfied, e.g.,
>
> G=[g1,g2,g3,g4,g5,g6,g7];
> infeasible=~all(G(:));
> x2(infeasible)=nan;
> x3(infeasible)=nan;
>
> Then plot as normal

i did this:

[g1,g2,g3,g4,g5,g6,g7]=constraints(x1,x2,x3,x4);
G1=[g1,g2,g4,g6,g7];
G2=[g3,g5];
infeasible=~all(G1(:))+all(G2(:));
x2(infeasible)=nan;
x3(infeasible)=nan;
%objective function
f=1.10471.*x1^2.*x2+0.04811.*x3.*x4.*(14.0+x2);
%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);
%plotting surf
surf(x2,x3,f,'LineStyle','none');

but still plot returns an empty area.

Date Subject Author
12/30/12 Emrah
1/6/13 Emrah
1/6/13 Derek Goring
1/7/13 Emrah
1/7/13 Matt J
1/7/13 Emrah
1/7/13 Matt J
1/7/13 Emrah
1/7/13 Matt J
1/7/13 Emrah
1/7/13 Matt J
1/7/13 Emrah
1/7/13 Matt J
1/7/13 Matt J
1/7/13 Emrah

© The Math Forum at NCTM 1994-2018. All Rights Reserved.