matlab程序运行得不到x值?在线等!
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/18 03:36:53
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
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
第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');
在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');
【Matlab程序运行出错】!
matlab程序运行,出错,
写出绘制函数y=x2+x-1图像的Matlab程序!非常急在线等
Matlab程序报错,高手帮帮忙啊!在线等!
matlab二分法,程序运行错误
MATLAB程序问题:运行下面的程序,
Matlab程序运行出错怎么修改
.Matlab程序运行后出现以下提示,
matlab程序如下:为什么提示运行出错?
matlab程序运行出现?Input argument "x" is undefined.Error in ==> my
Matlab中,运行程序出现The length of X must match the number of rows
在线等matlab二分法函数程序,要求:函数体中不使用feval函数