fany_涅槃
2009-05-07, 21:08
数据文件:
x1=[0.2 1.5 0.401;0.2 1.0 0.401;0.2 0.5 0.401;0.2 0 0.478;0.2 -0.5 0.5832;
0.4 1.5 0.401;0.4 1.0 0.401;0.4 0.5 0.401;0.4 0 0.5638; 0.4 -0.5 0.6413;
0.7 1.5 0.401;0.7 1.0 0.401;0.7 0.5 0.401;0.7 0 0.7037;0.7 -0.5 0.6271;
0.9 1.5 0.501;0.9 1.0 0.602;0.9 0.5 0.401;0.9 0 0.6575;0.9 -0.5 0.8564];
M-文件:
function f=wensheng(k,x)
f=3/(1256*x(1).^2*sqrt(k(1)*k(2)))*exp(-(x(2)-10*k(2)*x(1)).^2/40*k(2)*x(1))*exp(-10*k(3)*x(1));
执行程序:
X=[ones(size(x1(:,1))),x1(:,1:2)];
y=x1(:,3);
k0=[1 1 1];
k=nlinfit(X,y,'wensheng',k0)
执行程序的错误提示:
??? Error using ==> nlinfit at 129
MODELFUN should return a vector of fitted values the same length as Y.
希望高手给于指导,不胜感激!
x1=[0.2 1.5 0.401;0.2 1.0 0.401;0.2 0.5 0.401;0.2 0 0.478;0.2 -0.5 0.5832;
0.4 1.5 0.401;0.4 1.0 0.401;0.4 0.5 0.401;0.4 0 0.5638; 0.4 -0.5 0.6413;
0.7 1.5 0.401;0.7 1.0 0.401;0.7 0.5 0.401;0.7 0 0.7037;0.7 -0.5 0.6271;
0.9 1.5 0.501;0.9 1.0 0.602;0.9 0.5 0.401;0.9 0 0.6575;0.9 -0.5 0.8564];
M-文件:
function f=wensheng(k,x)
f=3/(1256*x(1).^2*sqrt(k(1)*k(2)))*exp(-(x(2)-10*k(2)*x(1)).^2/40*k(2)*x(1))*exp(-10*k(3)*x(1));
执行程序:
X=[ones(size(x1(:,1))),x1(:,1:2)];
y=x1(:,3);
k0=[1 1 1];
k=nlinfit(X,y,'wensheng',k0)
执行程序的错误提示:
??? Error using ==> nlinfit at 129
MODELFUN should return a vector of fitted values the same length as Y.
希望高手给于指导,不胜感激!