% Add the necessary lines of code after line 25 to compute the Tikhonov
% regularized solution of the linear equation Ax=mncn by using the so-called
% stacked form.
%
% The following routines must be run before this file:
% XRM1_matrix_comp.m and XRM3_NoCrimeData_comp.m.



% Load noisy measurements from disc.
loadcommand = ['load data/XRMC_NoCrime', num2str(N), ' N mnc mncn'];
eval(loadcommand)
mn = mncn;

% Load the measurement matrix and transform it to sparse form
loadcommand = ['load data/RadonMatrix', num2str(N), ' A measang target N P Nang'];
eval(loadcommand)




% Now we have in memory the matrix A and measurement mncn and we would like 
% to compute the Tikhonov regularized solution x for the equation Ax = mncn 
% using stacked form

% (add the needed code here)









% Plot the reconstruction x and the original image
figure;
subplot(1,2,1)
imagesc(reshape(x,N,N));
colormap gray
axis square
axis off
title('Reconstruction')
subplot(1,2,2)
imagesc(target);
colormap gray
axis square
axis off
title('Original image')



