matlab绘图--线性规划图解法示意

matlab绘图--线性规划图解法示意

线性规划问题:

1027162-20161006195219535-2063200619.png

matlab绘图

  1. L1=[4,0;4,4]
  2. plot(L1(:,1),L1(:,2));hold on 
  3. text(4.1,3.5,'x_1=4','color','b'); 
  4. L2=[0 3;5 3]
  5. plot(L2(:,1),L2(:,2));hold on 
  6. text(0.8,3.1,'x_2=3','color','b'); 
  7. L3=[0 2.4;5 0.4]
  8. plot(L3(:,1),L3(:,2));hold on 
  9. text(1,1.5,'2x_1+5x_2=12','color','b'
  10. L4=[0,4;4,2]
  11. plot(L4(:,1),L4(:,2)); 
  12. text(3,2.5,'x_1+2x_2=8','color','b'
  13. x=[0 0 2 4 4]'
  14. y=[2.4 3,3,2,0.8]'
  15. fill(x,y,'r'); 
  16. xlabel('x_1'
  17. ylabel('x_2'
  18. axis([0 5.3 -0.2 4]
  19. z0=[0,2.4;4.8,0]
  20. plot(z0(:,1),z0(:,2),'k--','LineWidth',2); 
  21. text(4.5,0.3,'z=4.8'
  22. z1=[0,2.8;4.6,0.5]
  23. plot(z1(:,1),z1(:,2),'k--','Linewidth',2); 
  24. text(4.6,0.5,'z=5.6'
  25. z2=[0,3;4.6,0.7]
  26. plot(z2(:,1),z2(:,2),'k--','Linewidth',2); 
  27. text(4.6,0.7,'z=6'
  28. z3=[0.6,3.7;4.6,1.7]
  29. plot(z3(:,1),z3(:,2),'g--','Linewidth',2); 
  30. text(4.6,1.7,'z=8'
  31. text(4,2,'A_2','color','r','fontsize',20); 
  32. text(2,3,'A_1','color','r','fontsize',20); 

结果图
enter description here

转载于:https://www.cnblogs.com/YiXiaoZhou/p/5934644.html

  • 8
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值