function f=confun2(x)
l=0.26;
B=0.436;
f=x(1)*x(3)*l*B/(x(2)+x(3))
function [g,c]=myfun2(x)
l=0.26;
B=0.436;
g(1)=15-1.25*2(x(1)+x(2))*l/(x(1)*x(2));
g(2)=18*x(2)*(3)/x(2)*x(3)*B-10;
g=[g(1);g(2)];
c=[];
clear,clc
x0=[0.0,0.0,2];
% A=[0 1 0];
% b=[0.63];
% lb=[0.09,0.172,2.04];
% ub=[0.218,0.3,2.2];
% options=optimset('LargeScale','off','Display','iter');
x=fmincon('confun2',x0,[],[],[],[],[],[],'myfun2');
怎么运行出来以后,老是出错啊!!实在是找不到是哪里错了,望各位指教一二,不胜感激!!
错误是:
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 274
In runfun2 at 9
??? Error using ==> fmincon
FMINCON cannot continue because user supplied nonlinear constraint function
failed with the following error:
Error: File: D:\Program Files\MATLAB71\work\ad\myfun2.m Line: 5 Column: 15
Unbalanced or misused parentheses or brackets.
Error in ==> runfun2 at 9
x=fmincon('confun2',x0,[],[],[],[],[],[],'myfun2'); |