% eecs 556, 2003, Exam #2, problem 2
N = 32;
wid = N/2-1;
[nn mm] = ndgrid([-N/2:N/2-1]);
uu = nn./N;
vv = mm./N;

im1 = (abs(nn) < wid/2).*(abs(mm) < wid/2);
im2 = real(fftshift(ifft2(ifftshift(sinc(wid.*uu).*sinc(wid.*vv)*(wid*wid)))));

theta = pi/6;
nr = cos(theta).*nn - sin(theta).*mm;
mr = cos(theta).*mm + sin(theta).*nn;
ur = cos(theta).*uu - sin(theta).*vv;
vr = cos(theta).*vv + sin(theta).*uu;
im1r = (abs(nr) < wid/2).*(abs(mr) < wid/2);
im2r = real(fftshift(ifft2(ifftshift(sinc(wid.*ur).*sinc(wid.*vr)*(wid*wid)))));

