求助 fmincon的问题
function f=wucha(x)A=[1.0000 1.0000 5.0000 6.5000 2.0000 3.5000 0.5000 1.0000 6.0000 8.5000;
0.0000 0.0000 1.0000 1.0000 0.6000 0.8000 0.1000 0.3000 3.0000 4.0000;
0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 0.2000 0.6000 3.5000 5.0000;
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 7.0000 9.0000;
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 ];
B=[1.0000 1.0000 A(1,3) A(1,4) A(1,5) A(1,6) A(1,7) A(1,8) A(1,9)A(1,10);
1/A(1,4)1/A(1,3) 1.0000 1.0000 A(2,5) A(2,6) A(2,7) A(2,8) A(2,9)A(2,10);
1/A(1,6)1/A(1,5) 1/A(2,6)1/A(2,5) 1.0000 1.0000 A(3,7) A(3,8) A(3,9)A(3,10);
1/A(1,8)1/A(1,7) 1/A(2,8)1/A(2,7) 1/A(3,8)1/A(3,7) 1.0000 1.0000 A(4,9)A(4,10);
1/A(1,10) 1/A(1,9) 1/A(2,10) 1/A(2,9) 1/A(3,10) 1/A(3,9) 1/A(4,10) 1/A(4,9) 1.00001.0000 ];
D=[log(B(1,4)/B(1,3)) -log(B(1,6)/B(1,5)) 0.0000 0.0000 log(B(2,6)/B(2,5)) 0.0000 0.0000 0.0000 0.0000 0.0000;
log(B(1,4)/B(1,3)) 0.0000 -log(B(1,8)/B(1,7)) 0.0000 0.0000 log(B(2,8)/B(2,7)) 0.0000 0.0000 0.0000 0.0000;
log(B(1,4)/B(1,3)) 0.0000 0.0000 -log(B(1,10)/B(1,9)) 0.0000 0.0000 log(B(2,10)/B(2,9)) 0.0000 0.0000 0.0000;
0.0000 log(B(1,6)/B(1,5)) -log(B(1,8)/B(1,7)) 0.0000 0.0000 0.0000 0.0000 log(B(3,8)/B(3,7)) 0.0000 0.0000;
0.0000 log(B(1,6)/B(1,5)) 0.0000 -log(B(1,10)/B(1,9)) 0.0000 0.0000 0.0000 0.0000 log(B(3,10)/B(3,9)) 0.0000;
0.0000 0.0000 log(B(1,8)/B(1,7)) -log(B(1,10)/B(1,9)) 0.0000 0.0000 0.0000 0.0000 0.0000 log(B(4,10)/B(4,9)) ];
d=;
wucha=sqrt(((D(1,:)*-d(1)))^2+((D(2,:)*-d(2)))^2+((D(3,:)*-d(3)))^2+((D(4,:)*-d(4)))^2+((D(5,:)*-d(5)))^2+((D(6,:)*-d(6)))^2)
以上为m文件
运行以下内容:
x0=;
lb=;
ub=;
=fmincon(@wucha,x0,[],[],[],[],lb,ub)
出现的错误:
??? Error using ==> fmincon at 504
FMINCON cannot continue because user supplied objective function failed with the following error:
Output argument "f" (and maybe others) not assigned during call to "C:\Documents and Settings\Administrator\My
Documents\MATLAB\wucha.m (wucha)".
那位高手能帮我看看怎么改一下,拜谢~ 找到原因了
页:
[1]