Hey, i am new to matlab and i want to plot 3d the constrains of an objective function.The constrains are 20000=<x=<40000,0=<y=<40000,0=<z=<40000, and x+y+z=90000.I want to plot it and get a plane for X=20000.Is there any similar code to work on it ?

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 12월 8일

0 개 추천

Here is my proposition:
[x,y] = meshgrid(20000:400:40000,0:800:40000);
z = 90000-x-y;
z(z>40000 | z<0) = NaN;
surf(x,y,z,'facecolor','none')
hold on
idx = x==20000;
plot3(x(idx),y(idx),z(idx),'r','LineWidth',2)
xlabel('x');ylabel('y');zlabel('z')

댓글 수: 1

antonios amato
antonios amato 2011년 12월 8일
I want to highlight the active region on the edges of the plot and apply on it one more constrain x+y>=60000
The surface must be a triangle as i sketch it on paper
i add this
idy= y==40000;
plot3(x(idy),y(idy),z(idy),'g','LineWidth',2)
and highlight one of the edges of the plot

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by