FODEMO Fourier Optics Demonstrations
SYNTAX; fodemo;
Requires RBCHART, BARCHART
by Chuck DiMarzio Northeastern University 2011
!! This file may be copied, used, or modified for educational and !! research purposes provided that this header information is not !! removed or altered, and provided that the book is cited in !! publications, as DiMarzio, Charles A., Optics for Engineers, !! CRC Press, Boca Raton, FL, 2011. !! http://www.crcpress.com !! Other distribution is prohibited without permission.
Contents
Points and lines
[x,y]=meshgrid(-512:511,-512:511); z=single((x.^2+y.^2)<25^2); % Pinhole object z(101:150,200:1024-50)=1; % Thin bar objects z(200:1024-50,101:150)=1; fig1=figure;imagesc(z);axis image;colormap(flipud(gray));axis off;

Knife Edge
z=zeros(1024,1024); z(:,512:end)=1; z(1:4,:)=1;z(:,1:4)=1;z(end-(0:3),:)=1;z(:,end-(0:3))=1; fig2=figure;imagesc(z);axis image;colormap(flipud(gray));axis off;

Bar charts
bx=barchart(1024,1024,64,Inf); bx(1:4,:)=1;bx(:,1:4)=1;bx(end-(0:3),:)=1;bx(:,end-(0:3))=1; fig3=figure;imagesc(bx);axis image;colormap(flipud(gray));axis off; by=barchart(1024,1024,Inf,64); by(1:4,:)=1;by(:,1:4)=1;by(end-(0:3),:)=1;by(:,end-(0:3))=1; fig4=figure;imagesc(by);axis image;colormap(flipud(gray));axis off;


Radial bar chart
rbc=single(rbchart(1200,40)); % Make it a little bigger than I intend to % plot to avoid errors at the edges. [px,py]=meshgrid((-50:50),(-50:50)); psf=single(px.^2+py.^2<22^2); img=conv2(rbc,psf,'same'); fig5=figure;imagesc(rbc(100:1100,100:1100));axis image;colormap(gray);axis off; fig6=figure;imagesc(img(100:1100,100:1100));axis image;colormap(gray);axis off;


Effect of pixels
30 pixels vertical and horizontal
wn=30;wm=30;sn=floor(size(rbc,1)/wn);sm=floor(size(rbc,1)/wm); r3030=zeros(sn,sm); for n=1:wn;for m=1:wm; r3030=r3030+rbc(n-1+[1:wn:sn*wn],m-1+(1:wm:sm*wm));end;end;r3030=r3030/wm/wn; fig7=figure;imagesc(r3030);colormap(gray);axis image;axis off; % 30 pixels vertical and 10 horizontal wn=30;wm=10;sn=floor(size(rbc,1)/wn);sm=floor(size(rbc,1)/wm); r3010=zeros(sn,sm); for n=1:wn;for m=1:wm; r3010=r3010+rbc(n-1+(1:wn:sn*wn),m-1+[1:wm:sm*wm]);end;end;r3010=r3010/wm/wn; fig8=figure;imagesc(1:30,1:30,r3010);colormap(gray);axis image;axis off;

