% Take a look at the results of file tomo02_firstTSVD_comp.m.
%
% Samuli Siltanen Feb 2017

% Parameters for controlling the plot
fsize = 16;

% Choose the size of the unknown. The image has size (2^j)x(2^j);
% let's denote n = (2^j)*(2^j).
j = 5;

% Choose the angles for tomographic projections
Nang   = 33; 

% Load results to disc
loadcommand1 = ['load data/TSVD_', num2str(j), '_', num2str(Nang), ' j M n Nang angles r_alpha recon f'];
eval(loadcommand1)
loadcommand2 = ['load data/RadonMatrix_', num2str(j), '_', num2str(Nang), ' A j M n Nang angles U D V svals'];
eval(loadcommand2)

% Take a look
figure(1)
clf
subplot(1,2,1)
imagesc(f)
set(gca,'xtick',[0:.25:1]*M,'fontsize',fsize)
set(gca,'ytick',[0:.25:1]*M,'fontsize',fsize)
axis equal
subplot(1,2,2)
imagesc(recon)
set(gca,'xtick',[0:.25:1]*M,'fontsize',fsize)
set(gca,'ytick',[0:.25:1]*M,'fontsize',fsize)
axis equal

% Take a look at the matrix and its singular values
figure(2)
clf
subplot(1,2,1)
spy(A)
set(gca,'xtick',[1,round([.25:.25:1]*size(A,2))],'fontsize',fsize)
set(gca,'ytick',[1,round([.25:.25:1]*size(A,1))],'fontsize',fsize)
title('Nonzero elements of A shown as blue dots','fontsize',fsize)
subplot(1,2,2)
semilogy(svals,'k.')
hold on
semilogy(svals(1:r_alpha),'r.')
xlim([1 length(svals)])
title('Singular values of A (log plot)','fontsize',fsize)
set(gca,'xtick',[1,round(length(svals)/2),length(svals)],'fontsize',fsize)