作业帮 > 英语 > 作业

呵呵 那个我知道了 ,不过还有个问题想麻烦您.

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/29 06:39:20
呵呵 那个我知道了 ,不过还有个问题想麻烦您.
我编的这个程序
clear all;
x=1:0.5:4.5;
y=[3.3 5.2 8.4 13.5 22 35.9 58.6 96];
beta=ones(2,3,1,2,3);
beta = nlinfit(x,y,@sd,beta);
结果出来yhat =
Columns 1 through 8 40.171 288.96 3289.9 60040 1.7697e+006 8.4654e+007 6.5941e+009 8.3839e+011
……
Function 'norm' is not defined for values of class 'double' and attributes 'full nd real'.
Error in ==> nlinfit at 204
if norm(step) < betatol*(sqrteps+norm(beta))怎么回事呢,要怎么改呢
请问你的拟合方程形式?
再问: function yhat = sd(beta,x) yhat =(beta(1)+beta(2).*x).*exp(beta(3)+beta(4).*x+beta(5).*x.^2) 对了 中间还有一个这个 Warning: Rank deficient, rank = 5, tol = 1.6671e-001. > In nlinfit at 161
再答: 用nlinfit还是没有求出。但可以用lsqcurvefit求出。 x=1:0.5:4.5; y=[3.3 5.2 8.4 13.5 22 35.9 58.6 96]; f=@(beta,x)(beta(1)+beta(2).*x).*exp(beta(3)+beta(4).*x+beta(5).*x.^2) beta=lsqcurvefit(f,[1,1,1,1,1],x,y) >> beta(1) ans = 1.0631e+003 >> beta(2) ans = 838.6782 >> beta(3) ans = -17.8825 >> beta(4) ans = 0.9413 >> beta(5) ans = 0.4819