机械优化设计作业

上传人:壹****1 文档编号:505098297 上传时间:2023-09-20 格式:DOCX 页数:8 大小:329.62KB
返回 下载 相关 举报
机械优化设计作业_第1页
第1页 / 共8页
机械优化设计作业_第2页
第2页 / 共8页
机械优化设计作业_第3页
第3页 / 共8页
机械优化设计作业_第4页
第4页 / 共8页
机械优化设计作业_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《机械优化设计作业》由会员分享,可在线阅读,更多相关《机械优化设计作业(8页珍藏版)》请在金锄头文库上搜索。

1、机械优化设计作业在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

2、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 objectiv

3、e 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 =

4、 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)二、目标函数依据题意,以主轴自身质量最小为设计目标,

5、即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=m

6、yfun(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

7、;-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 o

8、r 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,a

9、nd 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.9

10、587e-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

11、; 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: 16 lssteplength: 1 stepsize: 7.9012e-005 algorithm: medium-scale: SQP, Quasi-Newton, line-search firstorderopt: 7.5958e-007 constrviolation: 6.2446e-009 message: 1x788 char

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 研究生课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号