




免费预览已结束,剩余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秋招群面模拟题及高分话术
- 农发行邢台市襄都区2025秋招无领导小组面试案例库
- 定安县中储粮2025秋招网申填写模板含开放题范文
- 恭城瑶族自治县中储粮2025秋招笔试粮食政策与企业文化50题速记
- 内科医生个人工作总结(集锦15篇)
- 2025年度周口西华县中医院校园招聘17名考前自测高频考点模拟试题有完整答案详解
- 焦作市中石化2025秋招笔试模拟题含答案炼油设备技术岗
- 县城市供水突发事件应急预案范文(9篇)
- 2025年合肥热电集团社会招聘5人考前自测高频考点模拟试题及答案详解一套
- 煤矿安全规程2025版解读
- 哈里伯顿Sperry定向钻井介绍专题培训课件
- 2021年江苏省徐州市中考生物试卷(附详解)
- JJF 1704-2018 望远镜式测距仪校准规范
- 石油化工设备维护检修规程通用设备12
- 《三角形的面积》教学设计方案
- GB/T 14667.1-1993粉末冶金铁基结构材料第一部分烧结铁、烧结碳钢、烧结铜钢、烧结铜钼钢
- 带状疱疹及带状疱疹后神经痛
- 2022年毕节市农业发展集团有限公司招聘笔试试题及答案解析
- 卒中单元中的护理
- 中药鉴定学习题集全
评论
0/150
提交评论