Matfact_newcomer
A = [9 2 1 8;
8 5 6 10;
7 9 8 9;
2 3 4 8;
5 9 5 7];
rank = 2;
m = mean(A, 2);
s = std(A, 1, 2);
matm = repmat(m, 1, 4);
mats = repmat(s, 1, 4);
normA = (A - matm) ./ mats;
[u d v] = svd(normA)
vt = v';
temp = u(:, 1:rank)*d(1:rank, 1:rank)*vt(1:rank, :)
Ahat = matm + (temp .* mats)
u =
-0.5699 -0.1579 -0.5892 -0.5351 -0.1297
-0.5471 -0.3829 -0.0037 0.7322 -0.1339
0.3887 -0.5537 0.0504 -0.1310 -0.7230
-0.1319 -0.6232 0.4847 -0.3305 0.5001
0.4554 -0.3654 -0.6445 0.2261 0.4388
d =
3.0336 0 0 0
0 2.9144 0 0
0 0 1.5179 0
0 0 0 0.0000
0 0 0 0
v =
-0.5690 0.4985 -0.4216 0.5000
0.7368 -0.0436 -0.4530 0.5000
0.1603 0.3410 0.7798 0.5000
-0.3281 -0.7958 0.0948 0.5000
temp =
0.7543 -1.2537 -0.4339 0.9334
0.3882 -1.1743 -0.6465 1.4326
-1.4753 0.9392 -0.3612 0.8973
-0.6777 -0.2156 -0.6834 1.5767
-1.3170 1.0644 -0.1417 0.3943
Ahat =
7.6667 0.5676 3.4658 8.2999
7.9954 4.9950 6.0085 10.0010
7.0268 9.0288 7.9505 8.9940
2.7065 3.7590 2.6934 7.8411
4.3160 8.2652 6.2650 7.1538
댓글 없음:
댓글 쓰기