% EE 438 Digital Signal Processing with Applications - Spring 2001
% 2-D signals and systems% Image display within Matlab% Initialize
clear all;
close  all
%Initialize colormap
mcomp = 0 : 1.0 ./ 255 : 1.0; 
% output colors lie in [0,1]
map = [mcomp' mcomp' mcomp'];
M = 128;  
% size of image
index = (-M/2:1:M/2-1);
y = ones(M,1)*index;
x = y';
radius = 16;
z = x.*x + y.*y <= radius.*radius;
degrees = 90;
theta = pi*degrees/180;
P = 8;
rho = 1/P;
u = rho*cos(theta);
v = rho*sin(theta);
f = 0.5 + 0.5*cos(2*pi*(u*x + v*y));
g=z.*f;
figure(1);
image(g*255);
colormap(map);
axis('off');
axis('image');
g = fftshift(g);
G = fft2(g);
G = fftshift(G);
Gmag = abs(G);
Gmax = max(max(G));
decade = 2;
Gmag = Gmag/Gmax*10^decade + 1;
Gmag = log10(Gmag);
Gmax = max(max(Gmag));
figure(2);
image(Gmag*255/Gmax);
colormap(map);
axis('off');
axis('image');
