a matematical problem with matrix inversion
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all; i have a simple and stupid problem!! consider u is a non-squared matrix, why the following equation is not equal to Identity matrix when executing in MATLAB:
U' * inv( U * U') *U
Thanks in advance, Z.Z
0 Kommentare
Antworten (2)
Sean de Wolski
am 9 Aug. 2011
U = magic(4); %sample data
U = U(:,1:3); %non-square it
U'*(( U * U')\U) %see what happens:
ans =
1 -9.7145e-17 2.0817e-16
2.0817e-17 1 -1.6653e-16
1.3878e-17 8.3267e-17 1
the 10^-16 is just an artifact of floating point calculations. For all intensive purposes, the above is a 3x3 identity matrix.
Don't use inv, use '\'.
doc mldivide
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!