比较简单的形式可以不用nlinfit求解。
你将所有的数据代入那个表达式,会得到N个6元一次方程组(N是数据点数),求解这个方程组,就有一个最小二乘的解(N>6)
x=[0.00144 0.45
0.00144 0.475
0.00144 0.525
0.00144 0.55
0.00152 0.45
0.00152 0.475
0.00152 0.525
0.00152 0.55
0.00168 0.45
0.00168 0.475
0.00168 0.525
0.00168 0.55
0.00176 0.45
0.00176 0.475
0.00176 0.525
0.00176 0.55];
y = [45.69110212
44.24592344
41.94713721
40.58647715
43.86413153
42.02196312
40.52672275
41.19385838
49.83122281
45.92215843
40.71631097
40.28065749
45.73223359
44.81973606
43.23365342
42.49947777];
A=[ones(size(x(:,1))),x(:,1),x(:,2),x(:,1).^2,x(:,2).^2,x(:,1).*x(:,2)];
beta=A\y
plot(sort(y),sort(y),y,A*beta,'r*') %如果点在线两侧附近,说明拟合效果不错
xlabel('原始值')
ylabel('拟合值')
我试了的啊,可以求出来啊:
beta=nlinfit(x,y,f,beta0)
Warning: The Jacobian at the solution is ill-conditioned, and some
model parameters may not be estimated well (they are not identifiable).
Use caution in making predictions.
> In nlinfit at 223
beta =
1.0e+007 *
2.8570 -0.0065 -0.0000 2.8570 0.0000 -0.0043
你看看是不是你是不是哪粘贴错了.