免费预览已结束,剩余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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 文化体育馆项目竣工验收报告
- 跨学科融合背景下农林院校管理类课程改革
- 护理交接班常见问题及解决
- 艾灸护理安全操作规范
- 眼睛护理:保持眼部清洁
- 户外用品连锁2026年露营装备推广
- 2026年工作计划执行效果量化评估技巧与改进方向
- 2026年汽车机油选购技巧与更换周期手册
- 2026年企业健康讲座策划方案与员工健康意识提升
- 虚拟现实在护理教学中的实践探索
- 2025年瑜伽行业市场发展可行性研究报告及总结分析
- 2025届高考全国二卷第5题说题课件
- 2025云南昆明国际会展中心有限公司社会招聘8人备考题库及答案详解(历年真题)
- DB5206∕T 128-2020 梵净抹茶 加工技术规程
- 2025年国企考试综合基础知识题库及答案解析
- 25新二上语文1-8单元必背知识点
- 2025成人高考高升专试题含答案
- 特斯拉工作简历模板
- 超高分子量聚乙烯纤维项目申请报告
- 型钢孔型设计孔型设计的基本知识
- 竖窑控制系统手册
评论
0/150
提交评论