| 查看: 1001 | 回复: 0 | ||
[求助]
求助各位大神看看我的程序问题在哪里?着急啊
|
|
各位大神,帮忙指导下!我用的fmincon函数优化,但是出现这种错误,各位帮忙看看我的程序哪里有问题,非常感谢。 目标函数: function f=eg_mubiao(x) f=pi*pi*x(1)^2*x(2)*x(3)/cos(x(4)*pi/180)/4; 约束条件: function [g,ceq]=eg_yueshu(x) g(1)=1.66*8*9.52/pi*(x(1)/x(2))^0.16*x(2)/x(1)^3-445; g(2)=78000*x(1)^4/(8*x(2)^3*x(3))-1.213; g(3)=8*9.52*x(2)^3*x(3)/(78000*x(1)^4)+x(1)*x(3)-0.4*x(2)*x(3); g(4)=-(0.33*1520*x(1)^2.84+3.17*7.09*x(2)^0.84)/(4.23*9.52*x(2)^0.84)+1.5; g(5)=-365000*x(1)/(x(3)*x(2)^3)+10*50; g(6)=1.5*x(1)/x(2)+0.5*x(3)-5.3; g(7)=1.1*x(1)+9.81/x(3)-pi*x(2)*tan(x(4)*pi/180); ceq=[]; 调用文件: x0=[0.5,3.5,18,6.26]; A=[-14,1,0,0;4,-1,0,0;1,-1,0,0]; b=[0;0;-3]; lb=[0.5,3,2,5]; ub=[11,7,30,9]; [x,fn,exitflag,outflag]=fmincon(@eg_mubiao,x0,A,b,[],[],[],[],lb,ub,@eg_yueshu) 运行出现以下错误: eg Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details. > In fmincon at 378 In eg at 6 Error using optimfcnchk (line 286) NONLCON must be a function. Error in fmincon (line 435) confcn = optimfcnchk(NONLCON,'fmincon',length(varargin),funValCheck,flags.gradconst,false,true); Error in eg (line 6) [x,fval,exitflag,outflag]=fmincon(@eg_mubiao,x0,A,b,[],[],[],[],lb,ub,@eg_yueshu) |
» 猜你喜欢
全日制(定向)博士
已经有5人回复
假如你的研究生提出不合理要求
已经有10人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
实验室接单子
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复












回复此楼