What's the truncation error in SVD?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I'm trying to prove one thing: perform SVD on matrix a, the truncation error of singular values equals to truncation error of products of singular vectors. Here is the code:
clear; clc;
% PART 1.
% define the matrix a.
a = magic(8);
% define number of singular values left after truncation.
n = 2;
[u, s, v] = svd(a, 0);
% sum all singular values.
ds = diag(s);
dss = sum(ds);
% sum first n singular values
dssn = sum(ds(1:n));
% work out the error after truncation.
dsp = 1 - dssn / dss;
% PART 2
% multiply left singular vectors with singular values
u = u * s;
% select the first n singular vectors, i.e. to truncate
us = u(:, 1:n);
vs = v(:, 1:n);
% reconstruct the solution
ur = us * vs';
% work out the error
up = norm(ur - a, 'fro') / norm(a, 'fro');
I expect dsp = up, but dsp = 0.0431, up = 0.0613, why?
0 commentaires
Réponses (1)
Christine Tobler
le 30 Août 2017
Modifié(e) : Christine Tobler
le 30 Août 2017
Use dsp = norm(ds(n+1:end)) / norm(ds) instead of the sum.
This is because in norm(U*S*V', 'fro'), you can move U and V outside of the norm since they are orthogonal, leaving you with norm(S, 'fro'), and since S is diagonal, this is equal to norm(diag(S)).
0 commentaires
Voir également
Catégories
En savoir plus sur Eigenvalues dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!