matlab急求大神帮忙!!!跪求大神帮忙做个多元线性规划的matlab模型。

2024-11-30 17:06:59
推荐回答(2个)
回答1:

>> X=[128453,102398,28774,90302,128.6,64.1,64.5;
129227,116694,28559,90976,124.1,64.0,60.1;
129988,136515,27947,92184,122.9,64.2,58.7;
130756,182321,26504,94197,124.0,65.1,58.9;
131448,209407,25961,95068,120.9,68.1,52.8;
132129,246619,25660,95823,121.0,69.3,51.7;
132802,300670,25166,96681,121.4,70.6,50.8;
133474,335353,24663,97502,121.3,70.8,50.5];
y=[9377,9692,9857,10055,10419,10636,10956,11309]';
b=regress(y,X)
Warning: X is rank deficient to within machine precision.
> In regress at 82
b =
1.0078
0.0000
-1.0074
-1.0084
-1.1377
0
1.7495
>> format long
>> b
b =
1.007801520858404
0.000030873005326
-1.007447292805085
-1.008387438210722
-1.137728205821926
0
1.749524312878069

%警告的意思是X各列之间有线性相关的,所以regress会自动将X将某些列的系数置为0,使剩下的列线性相关。

回答2:

x=[ 128453,102398,28774,90302,128.6,64.1,64.5;
129227,116694,28559,90976,124.1,64.0,60.1;
129988,136515,27947,92184,122.9,64.2,58.7;
130756,182321,26504,94197,124.0,65.1,58.9;
131448,209407,25961,95068,120.9,68.1,52.8;
132129,246619,25660,95823,121.0,69.3,51.7;
132802,300670,25166,96681,121.4,70.6,50.8;
133474,335353,24663,97502,121.3,70.8,50.5];
y=[9377,9692,9857,10055,10419,10636,10956,11309]
y =
Columns 1 through 5
9377 9692 9857 10055 10419
Columns 6 through 8
10636 10956 11309