Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Lab #5

MA 402

Mathematics of Scientific Computing

Guidelines

● Labs should be done with a partner, if possible. You may submit the same code and a single report, and will receive a single grade.  Please list the names of everyone who worked on the lab.

● Submit a file (PDF preferable) with your written answers and all relevant plots and figures.

● Submit another file (e.g., .m or .py) with all of your code.  See the first homework assignment for further guidance guidance on what should go in the code vs the report.

● It is slightly more convenient for the professor to do the grading if you do not .zip your les.

 

Figure 1: Figure of a satellite before blur/noise


Inverse Problem (20 pts)

In this part of the assignment, you will get experience with deblurring a blurred image that has been corrupted by noise.

a)  Load the file “deblur.mat” using load in Matlab or scipy.io.loadmat in Python. You will find the variables A (blurring operator, size 4096×4096), bn (blurred and noisy image, size 4096 × 1), and xtrue (true image, size 4096 × 1). You will also find the factors of the SVD A=USV’, precomputed for your convenience.

b)  Given the problem setup

bnoisy  = Ax + 1.

we have the naive solution xnaive  = A  1 bnoisy .  Compute the naive solu- tion using \ or numpy.linalg.solve.1

c)  Plot the three images (original, blurred+noisy, naive recovery) in a single figure with 3 subplots using imshow. Note that you will have to reshape the vectors into 64 × 64 images.  For reference, Figure 1 shows what the true image is supposed to look like.

d)  Plot the singular values of A on a semilogy plot and compute the con- dition number n(A) = k1 /kn .   Given that  |bnoisy  − b|2 /|b|2   = 0705, explain why you would expect the naive solution to perform poorly.

e)  Using the SVD A = UΣVT , implement the truncated SVD formula xk  = VΣ k(−)1 Uk(T)

for k  = 400. 800. 7 7 7 . 3600.   In a single figure with 9 subplots, plot the reconstructed vectors xk  as images.  All of the results should look recog- nizably like the original image xtrue.

f)  Plot the relative error in the reconstructed solution as a function of the truncation rank k .  Report:  which image minimzes the error?  Which of the reconstructed images do you think looks best?  Are your answers to these two questions the same?

g) In your own words, explain why the plot of the relative error behaves the way it does.