How to plot this functions for linear programming
이전 댓글 표시
I have this functions, and I want to plot them on same page because this is a problem in linear programing and I want to show both on same graph.
First is: f = x+0.0625*x^2 + y+0.0125*y^2 + z+0.025*z^2 (this is objective function)
Second is: g=x+y+z-952 (this is boundary)
Thanks!
댓글 수: 4
Walter Roberson
2013년 1월 22일
Is one of the variables, x or y or z, being held as a constant? If not then you would be trying to plot in 4 dimensions, (x, y, z, f) which is going to be a problem.
Danijel
2013년 1월 22일
Walter Roberson
2013년 1월 22일
Are you asking to plot a single point, f(112,560,280) ??
If you are wanting to plot f over a range of values of x, and a range of values for y, and a range of values for z, then you need x, y, and z graphic axes to represent the inputs, but you also need another graphics axis to represent the result f(x,y,z) -- a 4 dimensional plot. Is that what you were thinking of?
Danijel
2013년 1월 22일
답변 (1개)
Since the solution has to satisfy
x+y+z=952
why not eliminate one of the variables, e.g.
h(x,y) = f(x,y,952-x-y)
and plot the 2D surface h(x,y) only? Why care about any other region?
BTW, your objective function is quadratic, so I'm not sure why you call this a "linear programming problem"
댓글 수: 10
Danijel
2013년 1월 22일
Danijel
2013년 1월 22일
Danijel
2013년 1월 22일
Matt J
2013년 1월 22일
Help with what? How can we find your bugs if you don't show your code?
Matt J
2013년 1월 22일
How about
[x,y] = meshgrid( linspace( -120, 600, 300 ) );
f =@(x,y,z) x+0.0625*x.^2 + y+0.0125*y.^2 + z+0.025*z.^2;
h= f(x,y,952-x-y);
surf(x,y,h)
Matt J
2013년 1월 24일
What is "the Lagrange solution"?
Danijel
2013년 2월 8일
Matt J
2013년 2월 8일
You can use the TEXT command to add annotation to plots
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!