% File: http://web.mit.edu/8.13/matlab/Examples/singleslit.m
% Date: 2008-June-13
% Author: Scott Sewell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% From Eugene Hecht's Optics: 4th Edition, Equation 10.17
% singleslit(b,l,f) plots the single slit diffraction pattern for
% a slit of width 'b' in mm
% a wavelength of 'l' in nm
% a slit-to-screen distance of 'f' in m.
% Produces a plot of intensity versus screen position in mm.
% I(theta) = I(0)sinc^2(Beta) where Beta = pi b/l
% One can see that 'Beta' is a relative measure of the width of the
% diffracting slit and the wavelength of light
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
b1=.1;
b2=.05;
l=632;
f=0.5;
theta=[-.02:.0001:.02];
beta1=pi*(b1/1000)/(l/1e9).*sin(theta);
beta2=pi*(b2/1000)/(l/1e9).*sin(theta);
y1=(sin(beta1)./beta1).^2;
y2=(sin(beta2)./beta2).^2;
plot(theta*f*1000,y1);
hold on;
plot(theta*f*1000,y2,'--');
legend('100\mum slit','50 \mum slit');
title('Diffraction pattern from a HeNe laser through a single slit at 50cm distance');
xlabel('Position on Screen [mm]')
ylabel('Intensity');