% function defocus5 takes the input a,
% which represents distance, and calculates
% h, the cylinder function, and H, its fft.

function [H,h] = defocus5(a)
x = -100:100;
y = -100:100;
z = ones(1,201);

A1 = x' * z ;
A2 = z' * y ;

R = sqrt(A1.^2 + A2 .^ 2);
cond = a ./ (2 .* pi);
c =  (.5 .* (2 .* pi)./(a.^2)) .*  (R == cond);
d =         (2 .* pi)./(a.^2)  .*  (R <  cond);
% note if R < a./(2.*pi)   then its zero

h = c + d;
HH = fft2(h,256,256);
u = 0:255;
v = 0:255;
u2 = exp(-i .* 2 .* pi ./ 256 .* (100) .* u);
v2 = exp(-i .* 2 .* pi ./ 256 .* (-100) .* v);
e = u2' * v2;
H = HH .* e;
return to image defocusing