主题:Matlab:想您请教:我的隐函数的参数估计怎么总报错啊?
Matlab:想您请教:我的隐函数的参数估计怎么总报错啊?
十万火急(下周就要想老板汇报工作,急!)
function y=sta67_8m(beta,x)
%Rs=beta(1);
%Rsh=beta(2);
%Il=beta(3);
%I0=beta(4);
K=1.38e-23;T=300;q=1.6e-19;
y=(beta(3).*beta(2)-(beta(4).*beta(2)).*(exp((x(2).*beta(1)-x(1)).*q./K./T)-1)+x(1))./(beta(2)+beta(1))-x(2);
x1=[8.00 8.00 10.00 10.00 10.00 10.00 12.00 12.00 12.00 14.00 14.00 14.00...
16.00 16.00 16.00 18.00 18.00 20.00 20.00 20.00 20.00 22.00 22.00 24.00...
24.00 24.00 26.00 26.00 26.00 28.00 28.00 30.00 30.00 30.00 32.00 32.00...
34.00 36.00 36.00 38.00 38.00 40.00 42.00]';
x2=[0.49 0.49 0.48 0.47 0.48 0.47 0.46 0.46 0.45 0.43 0.45 0.43 0.43 0.44 0.43...
0.43 0.46 0.42 0.42 0.43 0.41 0.41 0.40 0.42 0.40 0.40 0.41 0.40 0.41 0.41...
0.40 0.40 0.40 0.38 0.41 0.40 0.40 0.41 0.38 0.40 0.40 0.39 0.39]';
X=[x1 x2];
Y=x2*0;
beta0=[0.30 0.20 0.2 0.2];
[beta,r,j]=nlinfit(X,Y,'sta67_8m',beta0)
总是出错:
??? Error using ==> nlinfit
MODELFUN should return a vector of fitted values the same length as Y.
怎么回事啊?感谢帮助!
十万火急(下周就要想老板汇报工作,急!)
function y=sta67_8m(beta,x)
%Rs=beta(1);
%Rsh=beta(2);
%Il=beta(3);
%I0=beta(4);
K=1.38e-23;T=300;q=1.6e-19;
y=(beta(3).*beta(2)-(beta(4).*beta(2)).*(exp((x(2).*beta(1)-x(1)).*q./K./T)-1)+x(1))./(beta(2)+beta(1))-x(2);
x1=[8.00 8.00 10.00 10.00 10.00 10.00 12.00 12.00 12.00 14.00 14.00 14.00...
16.00 16.00 16.00 18.00 18.00 20.00 20.00 20.00 20.00 22.00 22.00 24.00...
24.00 24.00 26.00 26.00 26.00 28.00 28.00 30.00 30.00 30.00 32.00 32.00...
34.00 36.00 36.00 38.00 38.00 40.00 42.00]';
x2=[0.49 0.49 0.48 0.47 0.48 0.47 0.46 0.46 0.45 0.43 0.45 0.43 0.43 0.44 0.43...
0.43 0.46 0.42 0.42 0.43 0.41 0.41 0.40 0.42 0.40 0.40 0.41 0.40 0.41 0.41...
0.40 0.40 0.40 0.38 0.41 0.40 0.40 0.41 0.38 0.40 0.40 0.39 0.39]';
X=[x1 x2];
Y=x2*0;
beta0=[0.30 0.20 0.2 0.2];
[beta,r,j]=nlinfit(X,Y,'sta67_8m',beta0)
总是出错:
??? Error using ==> nlinfit
MODELFUN should return a vector of fitted values the same length as Y.
怎么回事啊?感谢帮助!