matlab拟合那个是常数项啊?A=[1 21.22 14.53 17.74 4.95 5.36 5.77 7.18 6.59 2.110 1.4] x=A(:,1)y=A(:,2)[p,brint,r,rint,starts]=regress(y,x)A =1.0000 21.20002.0000 14.50003.0000 17.70004.0000 4.90005.0000 5.30006.0000 5.70007.0000 7.10008.0000 6
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/29 03:54:01
matlab拟合那个是常数项啊?A=[1 21.22 14.53 17.74 4.95 5.36 5.77 7.18 6.59 2.110 1.4] x=A(:,1)y=A(:,2)[p,brint,r,rint,starts]=regress(y,x)A =1.0000 21.20002.0000 14.50003.0000 17.70004.0000 4.90005.0000 5.30006.0000 5.70007.0000 7.10008.0000 6
matlab拟合那个是常数项啊?
A=[1 21.2
2 14.5
3 17.7
4 4.9
5 5.3
6 5.7
7 7.1
8 6.5
9 2.1
10 1.4]
x=A(:,1)
y=A(:,2)
[p,brint,r,rint,starts]=regress(y,x)
A =
1.0000 21.2000
2.0000 14.5000
3.0000 17.7000
4.0000 4.9000
5.0000 5.3000
6.0000 5.7000
7.0000 7.1000
8.0000 6.5000
9.0000 2.1000
10.0000 1.4000
x =
1
2
3
4
5
6
7
8
9
10
y =
21.2000
14.5000
17.7000
4.9000
5.3000
5.7000
7.1000
6.5000
2.1000
1.4000
Warning:R-square is not well defined unless X has a column of ones.
Type "help regress" for more information.
> In D:\数学建模\matlab\toolbox\stats\regress.m at line 105
p =
0.8265
brint =
-0.3223 1.9753
r =
20.3735
12.8470
15.2205
1.5940
1.1675
0.7410
1.3145
-0.1119
-5.3384
-6.8649
rint =
2.9202 37.8268
-8.6030 34.2970
-5.0295 35.4706
-21.7776 24.9657
-21.9328 24.2679
-22.0145 23.4966
-20.9960 23.6250
-21.9428 21.7189
-26.1501 15.4732
-26.6891 12.9592
starts =
0.5462 NaN NaN
>>
matlab拟合那个是常数项啊?A=[1 21.22 14.53 17.74 4.95 5.36 5.77 7.18 6.59 2.110 1.4] x=A(:,1)y=A(:,2)[p,brint,r,rint,starts]=regress(y,x)A =1.0000 21.20002.0000 14.50003.0000 17.70004.0000 4.90005.0000 5.30006.0000 5.70007.0000 7.10008.0000 6
你的回归模型不对,改成下面的,p的第一项为常数项
>> A=[1 21.2
2 14.5
3 17.7
4 4.9
5 5.3
6 5.7
7 7.1
8 6.5
9 2.1
10 1.4]
x=A(:,1)
y=A(:,2)
X=[ones(10,1) x];
[p,brint,r,rint,starts]=regress(y,X)
A =
1.0000 21.2000
2.0000 14.5000
3.0000 17.7000
4.0000 4.9000
5.0000 5.3000
6.0000 5.7000
7.0000 7.1000
8.0000 6.5000
9.0000 2.1000
10.0000 1.4000
x =
1
2
3
4
5
6
7
8
9
10
y =
21.2000
14.5000
17.7000
4.9000
5.3000
5.7000
7.1000
6.5000
2.1000
1.4000
p =
19.1067
-1.9030
brint =
13.2301 24.9832
-2.8501 -0.9559
r =
3.9964
-0.8006
4.3024
-6.5945
-4.2915
-1.9885
1.3145
2.6176
0.1206
1.3236
rint =
-2.5781 10.5708
-8.7423 7.1411
-3.1572 11.7620
-12.9798 -0.2092
-12.1571 3.5741
-10.5240 6.5470
-7.1999 9.8290
-5.4138 10.6489
-7.8510 8.0922
-6.0266 8.6738
starts =
0.7285 21.4699 0.0017