>> X = rand(5,7)
X =
0.9797 0.1365 0.6614 0.5828 0.2259 0.2091 0.5678
0.2714 0.0118 0.2844 0.4235 0.5798 0.3798 0.7942
0.2523 0.8939 0.4692 0.5155 0.7604 0.7833 0.0592
0.8757 0.1991 0.0648 0.3340 0.5298 0.6808 0.6029
0.7373 0.2987 0.9883 0.4329 0.6405 0.4611 0.0503
>> [U,S,V] = svd(X)
U =
-0.4577 -0.4718 -0.4059 0.0775 0.6302
-0.3540 -0.2899 0.4478 -0.7626 -0.0921
-0.4681 0.7519 0.2577 0.0364 0.3845
-0.4451 -0.2974 0.4591 0.6288 -0.3276
-0.4979 0.1989 -0.5980 -0.1252 -0.5825
S =
2.8977 0 0 0 0 0 0
0 1.0642 0 0 0 0 0
0 0 0.8453 0 0 0 0
0 0 0 0.5135 0 0 0
0 0 0 0 0.3272 0 0
V =
-0.4899 -0.4371 -0.2957 0.6550 -0.0821 -0.2095 -0.0427
-0.2493 0.5680 0.1100 0.2375 0.5788 -0.3107 0.3393
-0.3948 0.1273 -0.6878 -0.4510 -0.0790 0.1805 0.3355
-0.3528 -0.0220 -0.0232 -0.2011 0.5041 0.2254 -0.7275
-0.4208 0.2507 0.2651 -0.2806 -0.5051 -0.5408 -0.2520
-0.3898 0.2531 0.3832 0.2442 -0.2862 0.6940 0.1184
-0.2975 -0.5854 0.4579 -0.3637 0.2467 -0.0457 0.4047
>> U*S*V‘
ans =
0.9797 0.1365 0.6614 0.5828 0.2259 0.2091 0.5678
0.2714 0.0118 0.2844 0.4235 0.5798 0.3798 0.7942
0.2523 0.8939 0.4692 0.5155 0.7604 0.7833 0.0592
0.8757 0.1991 0.0648 0.3340 0.5298 0.6808 0.6029
0.7373 0.2987 0.9883 0.4329 0.6405 0.4611 0.0503
>> S(5,5)=0
S =
2.8977 0 0 0 0 0 0
0 1.0642 0 0 0 0 0
0 0 0.8453 0 0 0 0
0 0 0 0.5135 0 0 0
0 0 0 0 0 0 0
>> U*S*V‘
ans =
0.9967 0.0172 0.6777 0.4789 0.3301 0.2681 0.5170
0.2690 0.0292 0.2820 0.4387 0.5646 0.3712 0.8016
0.2627 0.8211 0.4792 0.4521 0.8239 0.8193 0.0281
0.8669 0.2612 0.0563 0.3880 0.4757 0.6502 0.6293
0.7217 0.4090 0.9733 0.5290 0.5443 0.4066 0.0973
>>