% file:      	two_d_filter_ex_iv.m, (c) Matthew Roughan, Sat Aug 21 2004
%
N = 250; X = zeros(N,N); 
X(125,125) = 1;
M = 7;
D = filter2(ones(M,M)/M^2, X, 'same');
C = 10*log10(abs(fftshift(fft2(D))).^2);
C(find(C < -50)) = -50;

figure(4)
image(D, 'CDataMapping', 'scaled');
set(gca, 'xtick', [0:50:250], 'ytick', [0:50:250]);
set(gca, 'fontsize', 18);
title('signal');
colorbar;
set(gcf, 'PaperUnits', 'centimeters', 'PaperPosition', [0 0 12 10])
print('-depsc', sprintf('Plots/2d_filter_4a.eps', i));

figure(4)
image(C, 'CDataMapping', 'scaled');
set(gca, 'fontsize', 18);
title('power spectrum');
colorbar;
set(gcf, 'PaperUnits', 'centimeters', 'PaperPosition', [0 0 12 10])
print('-depsc', sprintf('Plots/2d_filter_4b.eps', i));

figure(5)
plot(mean(C), 'linewidth', 3);
set(gca, 'fontsize', 16, 'linewidth', 3);
set(gcf, 'PaperUnits', 'centimeters', 'PaperPosition', [0 0 25 10])
print('-depsc', sprintf('Plots/2d_filter_5.eps', i));
