请问如何多元回归拟合 。

我现在知道四组数据
Y=1.84099 9.67 23.00 38.12
1.848794 6.22 12.22 19.72
1.848794 5.19 10.09 15.31
X1=60.36558 59.5376 58.89861 58.74706
60.59389 60.36558 59.2 58.2
60.36558 59.97068 59.41918 58.89077
X2=26.1636 26.35804 26.82438 26.91521
25.90346 25.9636 27.19256 27.42153
26.1636 26.07212 26.58721 27.06063
X3=0.991227 0.994944 0.981322 0.98374
1.011865 0.991227 1.074772 1.107678
0.991227 0.917904 1.060438 1.1239
已知他们的关系是 log(a4*y)=a1*logx1+a2*logx2+a3*logx3
请问怎样求出这四个系数a1 a2 a3 a4啊,还有相关系数 p值 F值
求大神指点,matlab基本是零基础,最好把代码贴上来,谢谢大家啦。

 Accepted Answer

tawina
tawina on 21 Nov 2022

0 votes

y=[1.84099 9.67 23.00 38.12 1.848794 6.22 12.22 19.72 1.848794 5.19 10.09 15.31 ]';
x1=[60.36558 59.5376 58.89861 58.74706 60.59389 60.36558 59.2 58.2 60.36558 59.97068 59.41918 58.89077 ]';
x2=[26.1636 26.35804 26.82438 26.91521 25.90346 25.9636 27.19256 27.42153 26.1636 26.07212 26.58721 27.06063]';
x3=[0.991227 0.994944 0.981322 0.98374 1.011865 0.991227 1.074772 1.107678 0.991227 0.917904 1.060438 1.1239]';
X=[ones(size(x1)),log(x1),log(x2),log(x3)];
b=regress(log(y),X); %四个数分别对应着-log(a4),a1,a2,a3
plot(y)
hold on
plot(exp(X*a),'r')

More Answers (0)

Tags

Asked:

on 21 Nov 2022

Answered:

on 21 Nov 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!