用MATLAB解五元一次方程

来源:百度知道 编辑:UC知道 时间:2024/06/17 20:22:17
x 775 800 825 850 875
y 47.04 47.27 47.39 47.49 47.64
y=a+bx+cx2+dx3+ex4
其中x2,x3,x4分别表示x的几次方
求a b c d e

>> x=[775 800 825 850 875 ]';
y=[47.04 47.27 47.39 47.49 47.64 ]';
A=[ones(5,1) x x.^2 x.^3 x.^4];
xx=A\y
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.439940e-018.

xx =

1.0e+003 *

-1.4332
0.0066
-0.0000
0.0000
-0.0000

>> rref([A y])

ans =

1.0e+003 *

0.0010 0 0 0 0 -1.4332
0 0.0010 0 0 0 0.0066
0 0 0.0010 0 0 -0.0000
0 0 0 0.0010 0 0.0000
0 0 0 0 0.0010 -0.0000