% Plot the results of deco04_TSVD_comp.m
%
% Samuli Siltanen February 2017

load data/TSVD fstep m0 m_simul A svals U V mn fn r_alpha f0

% Parameters for controlling the plot appearance
fsize = 16;
lwidth = 1;

% Take a look
figure(1)
clf
plot(fstep,'k','linewidth',lwidth)
hold on
plot(m0,'r','linewidth',lwidth)
plot(m_simul,'b','linewidth',lwidth)


% Take a look at the matrix and its singular values
figure(2)
clf
subplot(1,2,1)
spy(A)
title('Nonzero elements in A','fontsize',fsize)
subplot(1,2,2)
semilogy(svals,'k.')
hold on
semilogy(svals(1:r_alpha),'r.')
title('Singular values of A (log plot)','fontsize',fsize)

% Take a look at few first singular vectors
figure(3)
clf
subplot(5,1,1)
plot(V(:,1))
title('Singular vector 1','fontsize',fsize)
subplot(5,1,2)
plot(V(:,2))
title('Singular vector 2','fontsize',fsize)
subplot(5,1,3)
plot(V(:,3))
title('Singular vector 3','fontsize',fsize)
subplot(5,1,4)
plot(V(:,4))
title('Singular vector 4','fontsize',fsize)
subplot(5,1,5)
plot(V(:,5))
title('Singular vector 5','fontsize',fsize)




figure(1)
clf
subplot(3,1,1)
plot(fstep,'k','linewidth',lwidth)
hold on
plot(mn,'r','linewidth',lwidth)
set(gca,'ytick',[0 1],'fontsize',fsize)
subplot(3,1,2)
plot(fstep,'k','linewidth',lwidth)
hold on
plot(f0,'b','linewidth',lwidth)
set(gca,'ytick',[0 1],'fontsize',fsize)
subplot(3,1,3)
plot(fstep,'k','linewidth',lwidth)
hold on
plot(fn,'b','linewidth',lwidth)
set(gca,'ytick',[0 1],'fontsize',fsize)

