How do I perform a truncated SVD on a matrix?

53 visualizaciones (últimos 30 días)
David Haydock
David Haydock el 14 de Ag. de 2020
Comentada: David Haydock el 16 de Ag. de 2020
Title says it all. I have an input matrix that I need to generate a truncated SVD for, so that I can calculate the SVD's reconstruction error. I know that svd is a function, but I can't find any functions anywhere that work specifically for a truncated SVD.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 14 de Ag. de 2020
Simply use the standard svd-function, then you can simply calculate the reconstruction-error at different truncation-levels by setting the eigenvalues outside of your trunkation to zero (that is what you do when trunkating, well close enough. If you want you can simply trunkate the U, S and V matrices too, but this way you cut out all thinking). Something like this:
Im = imread('cameraman.tif');
[U,S,V] = svd(double(Im));
subplot(1,3,1),imagesc(Im)
lambda = diag(S);
l50 = lambda;
l50(51:end) = 0;
subplot(1,3,2)
imagesc(U*diag(l50)*V')
subplot(1,3,3)
imagesc(double(Im)-U*diag(l50)*V')
HTH
  5 comentarios
Bjorn Gustavsson
Bjorn Gustavsson el 16 de Ag. de 2020
For initial overview-reading I typically recommend wikipedia (SVD low-rank approximation) for getting the very first overview. Then you can branch out in your desired directions - I mainly use SVD for inverse-problems, your needs might take you in other directions.
Then, the truncated SVD is the "best lower-rank approximation" (minimum Frobenius-norm) of your original matrix. As for how that relates to conditional average is not clear to me. I've only ever encountered conditional averaging in the context of averaging time-serieses syncronized relative to some triggering event (that might occur at "random" instanses in time). To me that seems to be something completely different than a truncated SVD-approximation. I suggest going back to whomever told you this and ask for a more detailed explanation...
David Haydock
David Haydock el 16 de Ag. de 2020
Thank you Bjorn!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra 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