% EE 438 Digital Signal Processing with Applications - Spring 1997
% 2-D signals and systems
% circ_jinc.m
% Spectrum of circ function
%---------------------------------------------------------------
% Initialize
clear all;
close all;
%---------------------------------------------------------------
% Parameters
radius=16;	% radius of circle
M=128;		% dimensions of image (MxM)
%---------------------------------------------------------------
%Initialize colormap
mcomp = 0 : 1.0 ./ 255 : 1.0; % output colors lie in [0,1]
map = [mcomp' mcomp' mcomp'];
index = (-M/2:1:M/2-1);
y = ones(M,1)*index;
x = y';
g = x.*x + y.*y <= radius.*radius;
figure(1);
image(g*255);
colormap(map);
axis('off');
axis('image');
title('g(x,y)=circ(x,y)');

g2 = fftshift(g);
G = fft2(g2);
G = fftshift(G);
Gmag = log10(abs(G));
Gmax = max(max(Gmag));
figure(2);
image(Gmag*255/Gmax);
colormap(map);
axis('off');
axis('image');
title('log|G(u,v)|');
