Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2015-09-11, 23:04   #1
sxhzwjls
初级会员
 
注册日期: 2015-09-11
帖子: 1
声望力: 0
sxhzwjls 正向着好的方向发展
默认 程序错误,求助

R2010b版本,运行下面程序错误,请指导,谢谢。
jsq_f.m
function f=jsq_f(x);
f=0.67+pi*(x(3)+2)*x(2)^3*((21*x(1)+2+6/(x(1)+2))^2-(21x(1)-6.4)^2)/4;


jsq_y.m
function[c,ceq]=jsq_y(x);
c(1)=20552.7/x(1)^2-x(2)^3*x(3);
c(2)=229400*x(1)^2*sqrt(1.3814*(x(1)/x(2))^2+0.132474)-x(2)^3*(x(3)-2.4)^4;
c(3)=0.85-0.95*x(1)*(X(3)-X(1)*0.024)/(x(1)*x(3)+0.024*x(3)^2);
c(4)=2659574/(x(2)*(x(3)+21*x(1)))^1.75-60;
ceq=[];


jsq_fy.m
x0=[2;8;10];
ib=[2;2;8];
ub=[3.81;16;18];
a=zeros(6,3);
a(1,1)=-1;a(2,1)=1;
a(3,2)=-1;a(4,2)=1;
a(5,3)=-1;a(6,3)=1;
b=[-2;3.81;-2;16;-8;18];
[x,fval]=fmincon(@jsq_f,x0,a,b,[],[],ib,ub,@jsq_y);
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms: set the
Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
??? Undefined function or method 'X' for input arguments of type 'double'.

Error in ==> jsq_y at 4
c(3)=0.85-0.95*x(1)*(X(3)-X(1)*0.024)/(x(1)*x(3)+0.024*x(3)^2);

Error in ==> fmincon at 654
[ctmp,ceqtmp] = feval(confcn{3},X,varargin{:});

Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation. FMINCON cannot continue.
sxhzwjls 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 13:53


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.