用MATLAB求多元线性拟合方程~急>> y=[3645.2 4062.6 4545.6 4889.5 5330.5 5985.6 7243.8 9040.7 10274.4 12050.6 15036.8 17000.9 18718.3 21826.2 26937.3 35260.0 48108.5 59810.5 70142.5 78060.8 83024.3 88479.2 98000.5 108068.2 119095.7 135174.0 1
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 14:25:02
用MATLAB求多元线性拟合方程~急>> y=[3645.2 4062.6 4545.6 4889.5 5330.5 5985.6 7243.8 9040.7 10274.4 12050.6 15036.8 17000.9 18718.3 21826.2 26937.3 35260.0 48108.5 59810.5 70142.5 78060.8 83024.3 88479.2 98000.5 108068.2 119095.7 135174.0 1
用MATLAB求多元线性拟合方程~急
>> y=[3645.2 4062.6 4545.6 4889.5 5330.5 5985.6 7243.8 9040.7 10274.4 12050.6 15036.8 17000.9 18718.3 21826.2 26937.3 35260.0 48108.5 59810.5 70142.5 78060.8 83024.3 88479.2 98000.5 108068.2 119095.7 135174.0 159586.7 185808.6 217522.7 267763.7 316228.8 34364.7];
x1=[1607.0 1769.7 1996.5 2048.4 2162.3 2375.6 2789 3448.7 3967 4585.8 5777.2 6484.0 6858.0 8087.1 10284.5 14188.0 19480.7 24950.6 29447.6 32921.4 34018.4 35861.5 40033.6 43580.6 47431.3 54945.5 65210.0 77230.8 91310.9 110534.9 130260.2 135239.9];
x2=[138.2 143.8 195.5 207.1 220.7 270.6 316.7 417.9 525.7 665.8 810.0 794.0 859.4 1015.1 1415.0 2266.5 2964.7 3728.8 4387.4 4621.6 4985.8 5172.1 5522.3 5931.7 6465.5 7490.8 8694.3 10367.3 12408.6 15296.5 18743.2 22398.8];
x2=[1027.5 1270.2 1371.6 1559.5 1777.4 1978.4 2316.1 2564.4 2788.7 3233.0 3865.4 4265.9 5062.0 5342.2 5866.6 6963.8 9572.7 12135.8 14015.4 14441.9 14817.6 14770.0 14944.7 15781.3 16537.0 17381.7 21412.7 22420.0 24040.0 28627.0 33702.0 35226.0];
用MATLAB求多元线性拟合方程~急>> y=[3645.2 4062.6 4545.6 4889.5 5330.5 5985.6 7243.8 9040.7 10274.4 12050.6 15036.8 17000.9 18718.3 21826.2 26937.3 35260.0 48108.5 59810.5 70142.5 78060.8 83024.3 88479.2 98000.5 108068.2 119095.7 135174.0 1
用regress线性拟合就行
首先将数据表示为列向量
>> y=y';
>> x1=x1';
>> x2=x2';
>> x3=x3';
然后形成拟合矩阵X=[ones(size(x1)) x1 x2 x3];
最后求解线性拟合系数p=regress(y,X);
p =[ -7404.97818878696
11.6974644599097
-71.8051970654931
2.61994567425803]
p分别是常数项 以及三个变量的系数,
即y=p(1)+p(2)*x1+p(3)*x2+p(4)*x3