%
% Optical Imaging and Spectroscopy
%
% David J. Brady
% Duke University
% www.opticalimaging.org
%
% Figure 6.18
%
%
% interesting otf's
%
% units are  inverse wavelengths
%
fnumber=2;
ratioP=1/.9;
apertureRange=linspace(-2,2,512);
[x,y]=meshgrid(apertureRange,apertureRange);
figure(1);set(gcf,'color','white');
field=sqrt(x.^2+y.^2);
h=P(field)-P(ratioP*field);
H=conv2(h,h,'same');
H=H/max(max(H));
fourierRange=linspace(-10,10,128);
subplot(2,2,1);imagesc(apertureRange,apertureRange,h);
title('Pupil function');axis square;
subplot(2,2,2);imagesc(apertureRange,apertureRange,H);
title('Modulation transfer');axis square;
subplot(2,2,4);plot(apertureRange,H(256,:),'-k');
xlabel('1/wavelength');title('MTF cross section');
subplot(2,2,3);plot(fourierRange,(jinc(fourierRange./(ratioP*fnumber))-jinc(fourierRange./fnumber)).^2,'-k');
xlabel('wavelengths');title('Impulse response');



