% File: http://web.mit.edu/8.13/matlab/Examples/doubleslit.m
% Date: 2008-June-13
% Author: Scott Sewell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% From Hecht, Optics, Edition 4, Equation 10.24
% doubleslit(b,a,l,f) plots the two slit diffraction pattern for
% a slit of width 'b' in mm
% a slit separation of 'a' 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.
%
% Recall that the irradiance from a single slit is given by:
% I(theta) = I(0)sinc^2(Beta) where Beta = pi b/l
%
% The effect of the 2nd slit is to modulate this pattern with
% the additonal term cos^2(alpha) where alpha is analogous to Beta
% but measures the relative lengths of the spacing between the two slits
% and the wavelength of light. This of course is effects the standard
% interference condition (maxima occur when the differential path
% length traveled by a plane wave = 2pi(lambda)
%
% Thus the irradiance distribtuion from two slits is the rapidly varying
% double slit interference pattern modulated by the single-slit diffraction
% pattern.
% Try doubleslit(0.1,0.4,632,.5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function[x,y]=doubleslit(b,a,l,f)
theta=[-.04:.00001:.04];
beta=pi*(b/1000)/(l/1e9).*sin(theta); % sets the characteristic single slit diffraction scale
alpha=pi*(a/1000)/(l/1e9).*sin(theta); % sets the double-slit modulation scale
y=4.*(sin(beta).^2./beta.^2).*(cos(alpha).^2); %Hecht Eq. 10.24, 2 slit irradiance distribution
plot(theta*f*1000,y);
title('Fraunhofer Diffraction from 2-Slits');
xlabel('Screen Position [mm]')
ylabel('Intensity');