求高手帮忙看以下程序
计算x6 x7 x8 x9 x10 分别为多少?U是个矩阵
myfun.m 文件
function f=myfun(x)
x=[0.19,0.21,0.24,0.19,0.17,x(6),x(7),x(8),x(9),x(10)];
u=[0.00096,-0.00045,-0.00037,-0.00012,-0.00003,-0.00008,0.00138,-0.00032,-0.00068,-0.00051;
-0.00045,0.00108,0,-0.00023,0.00022,0.00015,-0.00054,-0.0005,-0.00044,0.00120;
-0.00037,0,0.0012,0.0005,0.0018,-0.0001,-0.0007,0.00033,-0.00013,-0.00021;
-0.00012,-0.00023,0.0005,0.00038,0.00045,0.00024,-0.00016,-0.00017,-0.00011,-0.0007;
-0.00003,0.00022,0.0018,0.00045,0.00062,0.00032,-0.00001,0.00003,-0.00011,-0.0007;
-0.00008,0.00015,-0.0001,0.00024,0.00032,0.00038,-0.00018,0.00025,-0.0006,-0.00005;
0.00138,-0.00054,-0.0007,-0.00016,-0.00001,-0.00018,0.0022,-0.00023,-0.00062,-0.00065;
-0.00032,-0.0005,0.00033,-0.00017,0.00003,0.00025,-0.00023,0.00084,-0.0004,0.0014;
-0.00068,-0.00044,-0.00013,-0.00011,-0.00011,-0.0006,-0.00062,-0.0004,0.0023,-0.00016;
-0.00051,0.00120,-0.00021,-0.0007,-0.0007,-0.00005,-0.00065,0.0014,-0.00016,0.0022];
xt=[0.19;0.21;0.24;0.19;0.17;x(6);x(7);x(8);x(9);x(10)];
f=2.046*(xt.*u.*x)^0.5-0.047;
Untitled4.m文件
function[c,cep]=mycom(x)
x=[0.19,0.21,0.24,0.19,0.17,x(6),x(7),x(8),x(9),x(10)];
u=[0.00096,-0.00045,-0.00037,-0.00012,-0.00003,-0.00008,0.00138,-0.00032,-0.00068,-0.00051;
-0.00045,0.00108,0,-0.00023,0.00022,0.00015,-0.00054,-0.0005,-0.00044,0.00120;
-0.00037,0,0.0012,0.0005,0.0018,-0.0001,-0.0007,0.00033,-0.00013,-0.00021;
-0.00012,-0.00023,0.0005,0.00038,0.00045,0.00024,-0.00016,-0.00017,-0.00011,-0.0007;
-0.00003,0.00022,0.0018,0.00045,0.00062,0.00032,-0.00001,0.00003,-0.00011,-0.0007;
-0.00008,0.00015,-0.0001,0.00024,0.00032,0.00038,-0.00018,0.00025,-0.0006,-0.00005;
0.00138,-0.00054,-0.0007,-0.00016,-0.00001,-0.00018,0.0022,-0.00023,-0.00062,-0.00065;
-0.00032,-0.0005,0.00033,-0.00017,0.00003,0.00025,-0.00023,0.00084,-0.0004,0.0014;
-0.00068,-0.00044,-0.00013,-0.00011,-0.00011,-0.0006,-0.00062,-0.0004,0.0023,-0.00016;
-0.00051,0.00120,-0.00021,-0.0007,-0.0007,-0.00005,-0.00065,0.0014,-0.00016,0.0022];
xt=[0.19;0.21;0.24;0.19;0.17;x(6);x(7);x(8);x(9);x(10)];
c(1)=1.65*(xt.*u.*x)^0.5-0.047-0.05;
c(2)=3500*x6+2000*x7+2300*x8+2500*x9+4000*x10-12500;
c(3)=-3500*x6-2000*x7-2300*x8-2500*x9-4000*x10+9600;
cep(1)=0.032*0.19+0.036*0.21+0.042*0.24+0.048*0.19+0.046*0.17+0.048*x6 +0.044*x7 +0.04*x8 +0.07* x9+0.066 *x10-0.047;
cep(2)=0.19+0.21+0.24+0.19+0.17+x6+x7+x8+x9+x10;
计算结果
x=[0.19,0.21,0.24,0.19,0.17,0,0,0,0,0];Ib=zeros(10,1);
[x,fval]=fmincon('myfun',x,[],[],[],Ib,[],[],'Untitled4')
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 274
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Error using ==> times
Matrix dimensions must agree.
哪位高手帮你个忙看一下