How do I perform a truncated SVD on a matrix?

47 次查看(过去 30 天)
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.

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2020-8-14
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 个评论
Bjorn Gustavsson
Bjorn Gustavsson 2020-8-16
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...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by