Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
y =
0.2359
0.1151
0.1124
0.1043
0.5356
0.3297
0.2037
0.1904
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
y =
0.2359
0.1151
0.1124
0.1043
0.5356
0.3297
0.2037
0.1904
0.2359
0.1151
0.1124
0.1043
0.5356
0.3297
0.2037
0.1904
>> clear all
>> y=[0.235854045
0.115136791
0.112371462
0.104320337
0.535639413
0.329741379
0.203663793
0.190415741
]
y =
0.2359
0.1151
0.1124
0.1043
0.5356
0.3297
0.2037
0.1904
>> length(y)
ans =
>> x1=[0.580908492
0.248960782
0.158429589
0.116181698
2.323285492
0.995693782
0.633623316
0.464657098
]
x1 =
0.5809
0.2490
0.1584
0.1162
2.3233
0.9957
0.6336
0.4647
>> length(x1)
ans =
>> x2=[0.475844565
0.252047575
0.179581477
0.142310718
1.345740289
0.712818012
0.50787599
0.40247022
]
x2 =
0.4758
0.2520
0.1796
0.1423
1.3457
0.7128
0.5079
0.4025
x =
0.5809 0.4758
0.2490 0.2520
0.1584 0.1796
0.1162 0.1423
2.3233 1.3457
0.9957 0.7128
0.6336 0.5079
0.4647 0.4025
>> inv(x'*x)*(x'*y)
ans =
-0.1503
0.6565
>> ans*x
Error using *
Inner matrix dimensions must agree.
>> ans'*x
Error using *
Inner matrix dimensions must agree.
>> ans*x'
Error using *
Inner matrix dimensions must agree.
>> x
x =
0.5809 0.4758
0.2490 0.2520
0.1584 0.1796
0.1162 0.1423
2.3233 1.3457
0.9957 0.7128
0.6336 0.5079
0.4647 0.4025
>> ans
ans =
-0.1503
0.6565
>> ans'
ans =
-0.1503 0.6565
>> x*ans'
ans =
0.2251
0.1281
0.0941
0.0760
0.5343
0.3183
0.2382
0.1944
>> [ans y]
ans =
0.2251 0.2359
0.1281 0.1151
0.0941 0.1124
0.0760 0.1043
0.5343 0.5356
0.3183 0.3297
0.2382 0.2037
0.1944 0.1904
>> x2
x2 =
0.4758
0.2520
0.1796
0.1423
1.3457
0.7128
0.5079
0.4025
>> inv(x2'*x2)*(x2'*y)
ans =
0.4258
>> x2*ans
ans =
0.2026
0.1073
0.0765
0.0606
0.5731
0.3035
0.2163
0.1714
>> ans y
ans y
|
Error: Unexpected MATLAB expression.
>> [ans y]
ans =
0.2026 0.2359
0.1073 0.1151
0.0765 0.1124
0.0606 0.1043
0.5731 0.5356
0.3035 0.3297
0.2163 0.2037
0.1714 0.1904
>> ans(:,1).^2-y.^2
ans =
-0.0146
-0.0017
-0.0068
-0.0072
0.0415
-0.0166
0.0053
-0.0069
>> sum(ans)
ans =
-0.0070
z =
0.2026 0.2359
0.1073 0.1151
0.0765 0.1124
0.0606 0.1043
0.5731 0.5356
0.3035 0.3297
0.2163 0.2037
0.1714 0.1904
>> z(:,1)-y
ans =
-0.0333
-0.0078
-0.0359
-0.0437
0.0375
-0.0262
0.0126
-0.0190
>> ans.^2
ans =
0.0011
0.0001
0.0013
0.0019
0.0014
0.0007
0.0002
0.0004
>> sum(ans)
ans =
0.0070
>> ans/8
ans =
8.7233e-04
>> sqrt(ans)
ans =
0.0295
>>