MATLAB中5元一次方程:a*x+b*y+c*z+d*u+e*v=f。已知系数矩阵abcde和列向量f,用最小二乘法拟合求解方程组
现有从ABAQUS软件中得到的18组数据,要在Matlab中用最小二乘法拟合求值,不是一般的求解线性方程组,以下为18个方程组:1),2.5*x+25*y+62.5*z+...
现有从ABAQUS软件中得到的18组数据,要在Matlab中用最小二乘法拟合求值,不是一般的求解线性方程组,以下为18个方程组:
1), 2.5*x+25*y+62.5*z+6.25*u+625*v=21.25
2), 2.5*x+20*y+50*z+6.25*u+400*v=16.75
3), 2.5*x+50/3*y+125/3*z+6.25*u+2500/9*v=13.25
4), 2.5*x+100/7*y+250/7*z+6.25*u+10000/49*v=10.75
5), 2*x+25*y+50*z+4*u+625*v=20.75
6), 2*x+20*y+40*z+4*u+400*v=16
7), 2*x+50/3*y+100/3*z+4*u+2500/9*v=12.75
8), 2*x+100/7*y+200/7*z+4*u+10000/49*v=10.5
9), 5/3*x+20*y+100/3*z+25/9*u+400*v=15.75
10), 5/3*x+50/3*y+250/9*z+25/9*u+2500/9*v=12.5
11), 5/3*x+100/7*y+500/21*z+25/9*u+10000/49*v=10
12), 10/7*x+20*y+200/7*z+100/49*u+400*v=15.5
13), 10/7*x+50/3*y+500/21*z+100/49*u+2500/9*v=12
14), 10/7*x+100/7*y+1000/49*z+100/49*u+10000/49*v=9.5
15), 1.25*x+25*y+31.25*z+1.5625*u+625*v=18.75
16), 1.25*x+20*y+25*z+1.5625*u+400*v=12.75
17), 1.25*x+50/3*y+62.5/3*z+1.5625*u+2500/9*v=8
18), 1.25*x+100/7*y+120/7*z+1.5625*u+10000/49*v=1.75 展开
1), 2.5*x+25*y+62.5*z+6.25*u+625*v=21.25
2), 2.5*x+20*y+50*z+6.25*u+400*v=16.75
3), 2.5*x+50/3*y+125/3*z+6.25*u+2500/9*v=13.25
4), 2.5*x+100/7*y+250/7*z+6.25*u+10000/49*v=10.75
5), 2*x+25*y+50*z+4*u+625*v=20.75
6), 2*x+20*y+40*z+4*u+400*v=16
7), 2*x+50/3*y+100/3*z+4*u+2500/9*v=12.75
8), 2*x+100/7*y+200/7*z+4*u+10000/49*v=10.5
9), 5/3*x+20*y+100/3*z+25/9*u+400*v=15.75
10), 5/3*x+50/3*y+250/9*z+25/9*u+2500/9*v=12.5
11), 5/3*x+100/7*y+500/21*z+25/9*u+10000/49*v=10
12), 10/7*x+20*y+200/7*z+100/49*u+400*v=15.5
13), 10/7*x+50/3*y+500/21*z+100/49*u+2500/9*v=12
14), 10/7*x+100/7*y+1000/49*z+100/49*u+10000/49*v=9.5
15), 1.25*x+25*y+31.25*z+1.5625*u+625*v=18.75
16), 1.25*x+20*y+25*z+1.5625*u+400*v=12.75
17), 1.25*x+50/3*y+62.5/3*z+1.5625*u+2500/9*v=8
18), 1.25*x+100/7*y+120/7*z+1.5625*u+10000/49*v=1.75 展开
1个回答
展开全部
X=[2.5 25 62.5 6.25 625 21.25
2.5 20 50 6.25 400 16.75
2.5 50/3 125/3 6.25 2500/9 13.25
2.5 100/7 250/7 6.25 10000/49 10.75
2 25 50 4 625 20.75
2 20 40 4 400 16
2 50/3 100/3 4 2500/9 12.75
2 100/7 200/7 4 10000/49 10.5
5/3 20 100/3 25/9 400 15.75
5/3 50/3 250/9 25/9 2500/9 12.5
5/3 100/7 500/21 25/9 10000/49 10
10/7 20 200/7 100/49 400 15.5
10/7 50/3 500/21 100/49 2500/9 12
10/7 100/7 1000/49 100/49 10000/49 9.5
1.25 25 31.25 1.5625 625 18.75
1.25 20 25 1.5625 400 12.75
1.25 50/3 62.5/3 1.5625 2500/9 8
1.25 100/7 120/7 1.5625 10000/49 1.75];
Y=X(:,6);
x=X(:,1:5);
[B,BINT,R,RINT,STATS] =regress(Y,x);
B,BINT,STATS
rcoplot(R,RINT)
Warning: R-square and the F statistic are not well-defined unless X has a column of
ones.
Type "help regress" for more information.
> In regress at 162
B =
10.1988
-0.8053
0.0757
-2.3178
0.0435
BINT =
-10.9918 31.3893
-2.8312 1.2205
-0.4633 0.6148
-7.8949 3.2592
-0.0211 0.1081
STATS =
0.8551 18.3285 0.0000 4.2632
----------------------------------------------------
REGRESS Multiple linear regression using least squares.
regress采用的就是最小二乘法
[x y z u v]=[10.1988 -0.8053 0.0757 -2.3178 0.0435]
BINT 是置信区间
2.5 20 50 6.25 400 16.75
2.5 50/3 125/3 6.25 2500/9 13.25
2.5 100/7 250/7 6.25 10000/49 10.75
2 25 50 4 625 20.75
2 20 40 4 400 16
2 50/3 100/3 4 2500/9 12.75
2 100/7 200/7 4 10000/49 10.5
5/3 20 100/3 25/9 400 15.75
5/3 50/3 250/9 25/9 2500/9 12.5
5/3 100/7 500/21 25/9 10000/49 10
10/7 20 200/7 100/49 400 15.5
10/7 50/3 500/21 100/49 2500/9 12
10/7 100/7 1000/49 100/49 10000/49 9.5
1.25 25 31.25 1.5625 625 18.75
1.25 20 25 1.5625 400 12.75
1.25 50/3 62.5/3 1.5625 2500/9 8
1.25 100/7 120/7 1.5625 10000/49 1.75];
Y=X(:,6);
x=X(:,1:5);
[B,BINT,R,RINT,STATS] =regress(Y,x);
B,BINT,STATS
rcoplot(R,RINT)
Warning: R-square and the F statistic are not well-defined unless X has a column of
ones.
Type "help regress" for more information.
> In regress at 162
B =
10.1988
-0.8053
0.0757
-2.3178
0.0435
BINT =
-10.9918 31.3893
-2.8312 1.2205
-0.4633 0.6148
-7.8949 3.2592
-0.0211 0.1081
STATS =
0.8551 18.3285 0.0000 4.2632
----------------------------------------------------
REGRESS Multiple linear regression using least squares.
regress采用的就是最小二乘法
[x y z u v]=[10.1988 -0.8053 0.0757 -2.3178 0.0435]
BINT 是置信区间
追问
我是新手,能不能麻烦你说下每步的含义呢,论文里面需要,谢谢
追答
首先,把问题改写A*X=y的形式,
Y=X(:,6);相当于y
x=X(:,1:5);相当于X
然后采用多元线性回归求解回归系数
即采用regress
B,BINT,R,RINT,STATS
B回归系数 结果就是xyzuv
[x y z u v]=[10.1988 -0.8053 0.0757 -2.3178 0.0435]
BINT 是xyzuv置信区间
R,是回归预测y与实际值之间的误差
RINT是回归预测y与实际值之间的误差置信区间
STATS有四个参数
分别r2 就是表征拟合度 F统计量 概率p 和方差的一个估计
rcoplot(R,RINT)残差分析 作残差图
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询