免费预览已结束,剩余3页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
机械优化设计作业在MATLAB下编程如下:在MATLAB下编程如下:先编写M文件,建立目标函数function f=zuoye2(x)f=-x(1)*x(2)*x(3); 主程序如下: x0=1;1;1;A=-1,-2 ,-2;1,2,2;b=0;72;lb=zeros(3,1);x,fval,exitflag,output=fmincon(zuoye2,x0,A,b,lb)Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-setalgorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option tointerior-point or sqp and rerun. For more help, see Choosing the Algorithm in the documentation. In fmincon at 472Local minimum possible. Constraints satisfied.fmincon stopped because the predicted change in the objective functionis less than the default value of the function tolerance and constraints were satisfied to within the default value of the constraint tolerance.Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 2 x = 23.9997 12.0001 12.0001fval = -3.4560e+003exitflag = 5output = iterations: 9 funcCount: 42 lssteplength: 1 stepsize: 3.3708e-004 algorithm: medium-scale: SQP, Quasi-Newton, line-search firstorderopt: 0.0025 constrviolation: 0 message: 1x777 char 由题,先选取设计变量。一、设计变量由于材料已经给定,其质量只是内径d、外径D、跨距L及外伸端a的函数。因此设计变量为X=x1,x2,x2T=l,D,aT (1)二、目标函数依据题意,以主轴自身质量最小为设计目标,即Fx=14x1+x3x22-d2 (2)为材料密度。三、约束条件1)挠度要求y=Fa2(l+a)3EIy0 (3)上式中惯性矩I=(D4-d4)64,E为主轴弹性模量。将I、E代入得:64Fx32(x1+x3)3E(x24-d4)y0 (4)2)强度要求max=MmaxWz (5)Wz=(D4-d4)32D (6)由(5)(6)式可得:32Fx2x3(x24-d4) (7)3)边界约束条件300x1650,60x2110,90x3150 (8)四、将物理模型转化为数学模型minfx=14x1+x3x22-d2 (9)S.t.(10)在MATLAB中先建立目标函数M文件function f=myfun(x)f=6.16225*(x(1)+x(3)*(x(2)2-900)/1000000;因为约束为非线性,所以同样建立非线性约束M文件function c,ceq=mycon(x)F=15000;y0=0.05;c(1)=9.71*x(3)2*(x(1)+x(3)/(x(2)4-304)-1;c(2)=32*F*x(2)*x(3)/(3.14*(x(2)4-304)*180)-1;ceq=;在MATLAB命令窗口给出初始搜索值和线性约束,并调用优化程序:a=-1/300 0 0 0 -1/60 0 0 1/110 0 0 0 -1/90; 注:相比较式(10)的约束作了一个变形b=-1;-1;1;-1; x0=300;100;100; lb=zeros(3,1);x,fval,exitflag,output=fmincon(myfun,x0,a,b,lb,mycon)Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-setalgorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option tointerior-point or sqp and rerun. For more help, see Choosing the Algorithm in the documentation. In fmincon at 472Local minimum found that satisfies the constraints.Optimization completed because the objective function is non-decreasing in feasible directions, to within the default value of the function tolerance,and constraints were satisfied to within the default value of the constraint tolerance.Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 1 1 4 x = 300.0000 74.9069 90.0000fval = 11.3220exitflag = 1output = iterations: 7 funcCount: 33 lssteplength: 1 stepsize: 2.9587e-005 algorithm: medium-scale: SQP, Quasi-Newton, line-search firstorderopt: 1.1603e-009 constrviolation: 1.6105e-012 message: 1x788 char经比较可发现和此前的结果一致。同上,先建立目标函数M文件function f=fun(x)f=(x(1)-3)2+x(2)2;再建立非线性约束M文件function c,ceq=funcon(x)c(1)=x(1)2+x(2)-4;ceq=;在MATLAB命令窗口给出初始搜索值和线性约束,并调用优化程序: x0=1,1; a=-1 0;0 -1 b=-0.5;0 lb=zeros(2,1) x,fval,exitflag,output=fmincon(fun,x0,a,b,lb,funcon)Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 2 2 1x = 2.0000 0fval = 1.0000exitflag = 1output = iterations: 4 funcCount: 1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 绿色消费理念传播策略与2025年消费者环保消费习惯培养研究报告
- 新媒体环境下2025年广播影视行业融合传播策略创新研究报告
- 南通安全员b考试试题及答案
- 2025年离婚后子女探望权具体实施及财产分割合同
- 新能源汽车租赁项目年度支持政策执行合同
- 2025年绿色物流运输项目合作与市场开发合同模板
- 2025年企业员工宿舍管理与生活服务综合协议
- 2025年高端医疗器械研发与生产采购一体化合同
- 2025年智能办公楼节能施工与环保质量监控合作协议
- 2025年地铁车站智能通风系统设备研发与供应合同
- 电动车电池维修与更换合同
- 中医类新技术新项目申报书
- 股骨粗隆间骨折的健康教育
- 普通高等学校招生全国统一考试大纲 英语词汇表
- 无线网络运维和安全管理制度
- 社区生殖健康知识培训方案
- DB37-T 4687-2023 社会心理服务中心(站、室)建设运行规范
- 激光打印机维修培训资料全
- 耳鼻喉科患者的心理护理与干预策略
- 30道医院妇产科医生岗位高频面试问题附考察点及参考回答
- 机动车驾驶员培训备案表
评论
0/150
提交评论