a matematical problem with matrix inversion

7 visualizaciones (últimos 30 días)
Zahra
Zahra el 9 de Ag. de 2011
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

Respuestas (2)

Sean de Wolski
Sean de Wolski el 9 de Ag. de 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
Also, this for floating point explanation: FAQ6.1

Walter Roberson
Walter Roberson el 9 de Ag. de 2011

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by