MATLAB规划和作图,求帮助,急

来源:百度知道 编辑:UC知道 时间:2024/05/29 01:08:25
求助高手,帮忙
max=42*x1+87*x2;
3*x1+6*x2<=480;
4*x1+2*x2<=480;
x1>=x2;
x1>=0;
x2>=0;
规划后怎么能把最后的图形区域做出来,小的是菜鸟,初学,请求高手帮助,先谢谢了

f=[-42;-87];
A=[3,6;4,2;-1,1];
b=[480;480;0];
Aeq=[];
beq=[];
xmin=[0,0];
xmax=[inf,inf];
x0=xmin;
[x,fmin]=linprog(f,A,b,Aeq,beq,xmin,xmax,x0);
x,-fmin

得:
x =
53.3333
53.3333

ans =
6.8800e+003

syms x1 x2
ezplot('3*x1+6*x2-480',[0 160]),text(50,125,'3x_1+6x_2=480')
hold on
ezplot('4*x1+2*x2-480',[0 120]),text(20,75,'4x_1+2x_2=480')
ezplot('x1-x2',[0 120]),text(120,125,'x_1=x_2')
title([])