| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 910 人关注过本帖
标题:[求助]程序出错了
只看楼主 加入收藏
子度
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-4-17
收藏
 问题点数:0 回复次数:0 
[求助]程序出错了
约束条件文件
function [c,ceq]=mycon(x)
c(1)=6*5660*x(3)/(0.09*4*x(1)^2)-500*10^6;
if x(3)>(x(4)-0.045)*(2*x(1)/x(2)-1)
q=1.5*5660*(x(2)-x(1))*((x(4)-x(3)-0.045)/(x(2)-x(1)))^2/(0.09*4*(x(1)*(x(4)-0.045)-x(2)*0.045);
else
q=6*5660*(x(4)-0.045)/(0.09*4*x(2)^2);
c(2)=q-500*10^6;
end ;
k=6*2.1*10^11*0.92*4*0.09*x(2)^3/(12*x(4)^3*(1+((x(4)-0.045)/x(4))^3)*(1-2*(x(3)/(x(4)-0.045))^1.5)+(x(3)/X(4))^3*(x(2)/x(1)));
c(3)=fabs((k-73500)/73500-0.005;
ceq=0;
A=[-1 0 0 0
0 1 0 0
1 -1 0 0
0 0 -1 0
0 0 0 1];
b=[0.0083;0.02;-0.001;0;0.6];

目标函数文件
function f=myfun(x)
f=2*7.8*10^3*9.8*0.09*4*(x(1)*x(3)+(x(4)-x(3)-0.045)*(x(1)+x(2))/2+x(2)*0.045)
命令窗口的命令
b=[0.0083;0.02;-0.001;0;0.6];
A=[-1 0 0 0
0 1 0 0
1 -1 0 0
0 0 -1 0
0 0 0 1];
x0=[0.01;0.025;0.04;0.6];
lb=zeros(4,1);
[x,fval,exitflag,output,lambda]=fmincon(@opt0202514_o,x0,A,b,[],[],[],[],@opt_0202514_c)




Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 271
??? Error using ==> fmincon
FMINCON cannot continue because user supplied nonlinear constraint function
failed with the following error:
Error using ==> feval
Undefined command/function 'opt_0202514_c'.
搜索更多相关主题的帖子: function else 
2006-04-22 10:15
快速回复:[求助]程序出错了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015743 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved