216 CHAPTER 5. EPIDEMICS, IMAGES AND MONEY
1-38 initialize the data, the blurring matrix, and the true and distorted images,
which are graphed in figure(1). The Picard iteration is done in lines 39-94,
and the relative error is computed in line 95. The conjugate gradient method
is used in lines 54 and 55 where an enhanced output of the "convergence" is
Lines 83-89 complete figure(1) where the restored images are now graphed, see
a cross-section.
MATLAB Code image_2d.m
1. % Variation on MATL AB code written by Curt Vogel,
2. % Dept of Mathematical Sciences,
3. % Montana State University,
4.
5. % "Computational Methods for Inverse Problems".
6. %
7. % Use Picard fixed point iteration to solve
8. % grad(T(u)) = K’*(K*u-d) + alpha*L(u)*u = 0.
9. % At each iteration solve for newu = u+du
10. % (K’*K + alpha*L(u)) * newu = K’*d where
11. % L(u) =( D’* diag(psi’(|[D*u]_i|^2,beta) * D * dx
12. Setup2d % Defines true2d image and distorts it
13. max_fp_iter = input(’ Max. no. of fixed point iterations = ’);
14. max_cg_iter = input(’ Max. no. of CG iterations = ’);
15. cg_steptol = 1e-5;
16. cg_residtol = 1e-5;
17. cg_out_flag = 0; % If flag = 1, output CG convergence info.
18. reset_flag = input(’ Enter 1 to reset; else enter 0: ’);
19. if exist(’f_alpha’,’var’)
20. e_fp = [];
21. end
22. alpha = input(’ Regularization parameter alpha = ’);
23. beta = input(’ TV smoothing parameter beta = ’);
24. % Set up discretization of first derivative operators.
25. n = nfx;
26. nsq = n^2;
27. Delta_x = 1 / n;
28. Delta_y = Delta_x;
29. D = spdiags([-ones(n-1,1) ones(n-1,1)], [0 1], n-1,n) / Delta_x;
30. I_trunc1 = spdiags(ones(n-1,1), 0, n-1,n);
31. Dx1 = kron(D,I_trunc1); % Forward di
erencing in x
32. Dy1 = kron(I_trunc1,D); % Forward di
erencing in y
33. % Initialization.
34. k_hat_sq = abs(k_hat).^2;
35. Kstar_d = integral_op(dat,conj(k_hat),n,n); % Compute K’*dat.
© 2004 by Chapman & Hall/CRC
Figure 5.4.1. Lines 91-93 generate figure(4), which is a one dimensional plot of
%for Chapter 8 of the SIAM Textbook,
given in figure(2), see lines 66-82. The Picard update is done in lines 56 and 57.