clear format compact %% % We use an image that is built into MATLAB. load('mandrill', 'X') [m, n] = size(X) figure(1) image(X) colormap(gray(256)) axis equal title('Original image') %% % We define the one-dimensional tridiagonal blurring matrices. v = [1/4 1/2 1/4]; B = spdiags(repmat(v,m,1), -1:1, m, m); C = spdiags(repmat(v,n,1), -1:1, n, n); %% % Finally, we show the results of using k=12 repetitions of the blur in % each direction. blur = @(X, k) B^k * X * C^k; nbl = 16; figure(2) colormap(gray(256)) image(blur(X, nbl)) axis equal title('Blurred image')