% file:      	two_d_filter_ex_51.m, (c) Matthew Roughan, Mon Jul 24 2006
%                    Laplacian edge detection
N = 250;  x = (1:N)/N;
[X, Y] = meshgrid(x,x);
A = ((X-0.5).^2 + (Y-0.5).^2) < 0.007;
K = [[1 1 1  1 1]
     [1 1 1  1 1]
     [1 1 24 1 1]
     [1 1 1  1 1]
     [1 1 1  1 1]];
D = filter2(K/sum(sum(K)), A, 'same');
C = 10*log10(abs(fftshift(fft2(D))).^2);
C(find(C < -50)) = -50;

figure(51)
subplot(1,2,1)
image(D, 'CDataMapping', 'scaled');
set(gca, 'xtick', [0:50:250], 'ytick', [0:50:250]);
set(gca, 'fontsize', 18);
title('signal');
colorbar;

figure(51)
subplot(1,2,2)
image(C, 'CDataMapping', 'scaled');
set(gca, 'fontsize', 18);
title('power spectrum');
colorbar;

set(gcf, 'PaperUnits', 'centimeters', 'PaperPosition', [0 0 25 10])
print('-depsc', sprintf('Plots/2d_filter_51.eps', i));

