What's the truncation error in SVD?

6 views (last 30 days)
Xiaohan Du
Xiaohan Du on 30 Aug 2017
Edited: Christine Tobler on 30 Aug 2017
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?

Answers (1)

Christine Tobler
Christine Tobler on 30 Aug 2017
Edited: Christine Tobler on 30 Aug 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)).

Categories

Find more on Eigenvalues in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!