MATLAB实验报告7.docVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
MATLAB实验报告7

1.Carpenter Problem. A carpenter makes tables and bookcases. He is trying to determine how many each type of furniture he should make each week The carpenter realizes a net unit profit of $25 per table and $30 per bookcase. He has up to(多达) 600 board feet of lumber to devote weekly to the project and up to 120 hours of labor. He estimates that it requires 20 board feet of lumber and 5 hours of labor to complete a table and 30 board feet of lumber and 4 hour of labor for a bookcase. Moreover, he signed a contract to deliver four tables and two bookcases each week. The carpenter wishes to determine a weekly production schedule for tables and bookcases that maximize his profits. 设桌子的个数为x1,书架的个数为x2 f=[-25,-30]; A=[20 30;5 4]; b=[600;120]; Aeq=[];beq=[]; lb=[4;2]; ub=[inf,inf]; [x,feval]=linprog(f,A,b,Aeq,beq,lb,ub) Optimization terminated. x = 17.1429 8.5714 feval = -685.7143 则最优解为桌子17.1429 书架8.5714 最大利润为685.7143 2. Solve the Ladder Problem by using three methods. (Animation is optional) Suppose there is a big house with two levels. A flower house made of glass is next to it. On the side where the two houses are next to each other, there is a window. Assume we put a ladder onto the wall over the glass house, so that we can clean the window by standing on top of the ladder. What is the shortest length of the ladder? 设房屋的高度为H=10米,花房高度为h=5米,宽度s=3米。 (1)第一种解法: 设梯子总长为z,上半段长为x,下半段长为y,则有 条件: x/(x+y)=s/(s+(y^2-h^2)^(1/2))即为x*(y^2-25)(1/2)-3*y=0 x^2-s^2=(H-h)^2,y0即为x^2=34 求解: Min z=x+y 代码: function f=fun(x) f=x(1)+x(2) function [c,ceq]=confun(x) c=[] ceq=[x(1)*(x(2)^2-25)^(1/2)-3*x(2)] [x,fval]=fmincon(@fun,[4,6],[],[],[],[],[0,0],[34^(1/2),inf],@confun) 结果 No active inequalities. x = 4.6531 6.5410 fval = 11.1941 (2)第二种解法: 设梯上小三角形高度为x,下小三角形的底为y,则 条件: x/(x+h)=s/(s+y)即为xy=sh 0xH-h,y0 求解: Min z=(x^2+s^2)^(1/2)+(y^2+h^2)^(1/2) 代码: function f=fun(x) f=(x(1)+9)^(1/2)+(x(2)+25)^(1/2) function [c,ceq]=confun(x) c=[] ceq=[x(1)*x(2)-15] [x,fval]=fmincon(@fun,

文档评论(0)

cuotian + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档