% file:      	two_d_filter_ex_vi.m, (c) Matthew Roughan, Sat Aug 21 2004
%                  Sobel filter
N = 250; 
x = (1:N)/N;
[X, Y] = meshgrid(x,x);
A = ((X-0.5).^2 + (Y-0.5).^2) < 0.007;
V = [[-1 -2 -1];[0 0 0];[1 2 1]];
H = [[-1 0 1];[-2 0 2];[-1 0 1]];
Dv = filter2(V, A, 'same');
Cv = 10*log10(abs(fftshift(fft2(Dv))).^2);
Cv(find(C < -50)) = -50;

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

figure(6)
subplot(1,2,2)
image(Cv, '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_6.eps', i));

