% Gen_data.m % % MATLAB code written by Curt Vogel, Dept of Mathematical Sciences, % Montana State University, for Chapter 1 of the SIAM Textbook, % "Computational Methods for Inverse Problems". % % Set up a discretization of a convolution integral operator K with a % Gaussian kernel. Generate a true solution and convolve it with the % kernel. Then add random error to the resulting data. % Also, compute an eigendecomposition of the discretized operator. % Set up parameters. n = 80; %%%input(' No. of grid points = '); sig = .05; %%%input(' Kernel width sigma = '); err_lev = 2; %%%input(' Percent error in data = '); % Set up grid. h = 1/n; x = [h/2:h:1-h/2]'; % Compute matrix K corresponding to convolution with Gaussian kernel. kernel = (1/sqrt(pi)/sig) * exp(-(x-h/2).^2/sig^2); K = toeplitz(kernel)*h; % Set up true solution f_true and data d = K*f_true + error. f_true = .75*(.1