matlab程序运行得不到x值?在线等!function f=fun(x)f=0.0393*x(1)*((x(2)+2*x(4))^2+(x(3))^2)^(0.5);function [c,ceq]=mycon(x)c(1)=90+10*0.4975-0.5*x(1)*(x(2)+10*x(3)+2*x(4));c(2)=0.5*x(1)*(x(2)+10*x(3)+2*x(4))-275+25*0.4975;c(3)=262465.2517*(0.
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 13:55:51
matlab程序运行得不到x值?在线等!function f=fun(x)f=0.0393*x(1)*((x(2)+2*x(4))^2+(x(3))^2)^(0.5);function [c,ceq]=mycon(x)c(1)=90+10*0.4975-0.5*x(1)*(x(2)+10*x(3)+2*x(4));c(2)=0.5*x(1)*(x(2)+10*x(3)+2*x(4))-275+25*0.4975;c(3)=262465.2517*(0.
matlab程序运行得不到x值?在线等!
function f=fun(x)
f=0.0393*x(1)*((x(2)+2*x(4))^2+(x(3))^2)^(0.5);
function [c,ceq]=mycon(x)
c(1)=90+10*0.4975-0.5*x(1)*(x(2)+10*x(3)+2*x(4));
c(2)=0.5*x(1)*(x(2)+10*x(3)+2*x(4))-275+25*0.4975;
c(3)=262465.2517*(0.5*x(1)*(x(2)+10*x(3)+2*x(4)))^(-1.5)-275+25*0.4975;
ceq=0;
x0=[2;9;2;0.6];
lb=[2;7.598;1;0.4749];
ub=[20;16.804;6;1.5754];
[x,fval,exitflag,output]=fmincon('fun',x0,[],[],[],[],lb,ub,'mycon');
qq:476393217
matlab程序运行得不到x值?在线等!function f=fun(x)f=0.0393*x(1)*((x(2)+2*x(4))^2+(x(3))^2)^(0.5);function [c,ceq]=mycon(x)c(1)=90+10*0.4975-0.5*x(1)*(x(2)+10*x(3)+2*x(4));c(2)=0.5*x(1)*(x(2)+10*x(3)+2*x(4))-275+25*0.4975;c(3)=262465.2517*(0.
第1步.目标函数
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f=fun(x)
f=0.0393*x(1)*((x(2)+2*x(4))^2+(x(3))^2)^(0.5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
第2步.约束条件
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [c,ceq]=mycon(x)
c(1)=90+10*0.4975-0.5*x(1)*(x(2)+10*x(3)+2*x(4));
c(2)=0.5*x(1)*(x(2)+10*x(3)+2*x(4))-275+25*0.4975;
c(3)=262465.2517*(0.5*x(1)*(x(2)+10*x(3)+2*x(4)))^(-1.5)-275+25*0.4975;
ceq=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
第3步.求解
在Matlab下面输入:
x0=[2;9;2;0.6];
lb=[2;7.598;1;0.4749];
ub=[20;16.804;6;1.5754];
[x,fval,exitflag,output]=fmincon('fun',x0,[],[],[],[],lb,ub,'mycon');