Home

Introduction

Contents

Scripts

FeedBack

Date 08/09/2010
Script S5_2_14.m
Download Script S5_2_14.m
%=============================================
%Grating 3
%=============================================
%
%the two wavelengths in microns
lambda1=0.58900;
lambda2=0.58958;
%N is defined applying the Rayleigh criterion with m = 1
Rayl=lambda1/(lambda2-lambda1);
N=ceil(Rayl)
%distance d between the slits
%and their widths h are in microns
d=6;
h=2;
%angular positions teta1 in degrees and in radians
teta1g=5:0.0001:6;
%!!!
%a very great number of elements is necessary
%for the array teta1g and for the next related arrays
%!!!
Mteta1=length(teta1g);
teta1=teta1g*(pi/180);
%
%=============================================
%the square of the formula sin(alfa)/alfa
%=============================================
%
fatth=(pi*h)*sin(teta1);
alfa1=fatth./lambda1;
alfa2=fatth./lambda2;
coef1n=sin(alfa1).^2;
coef2n=sin(alfa2).^2;
coef1d=alfa1.^2;
coef2d=alfa2.^2;
difr1=coef1n./coef1d;
difr2=coef2n./coef2d;
%
%=============================================
%the square of the formula sin(Nbeta)/(Nsen(beta))
%=============================================
%
fattd=(pi*d)*sin(teta1);
beta1=fattd./lambda1;
beta2=fattd./lambda2;
arg1=N*beta1;
arg2=N*beta2;
num1=sin(arg1);
num2=sin(arg2);
den1=N*sin(beta1);
den2=N*sin(beta2);
%
Int1=num1./den1;
Int2=num2./den2;
%
Intr1=Int1.^2;
Intr2=Int2.^2;
%
%=============================================
%relative intensity Ir1 and Ir2 for the two
%lines of the first order and their sum
%=============================================
%
Ir1=difr1.*Intr1;
Ir2=difr2.*Intr2;
Ir=Ir1+Ir2;
%corresponding plots
plot(teta1g,Ir1,'r-',teta1g,Ir2,'b-',teta1g,Ir,'g-')
title('Ir1 (red for lambda1), Ir2 (blue for lambda2), Ir (green for their sum)')
%
%!!! a very narrow interval of angles is used in the plot!!!
axis([5.628 5.645 0 0.7])
%
%=============================================
%maxima of Ir1, Ir2, their positions into the
%arrays, their angular positions
%=============================================
%
%maxima and their positions into the arrays Ir1 and Ir2
[maxIr1,indmax1]=max(Ir1)
[maxIr2,indmax2]=max(Ir2)
%corresponding angular positions for the maxima
angmax1=teta1g(indmax1)
angmax2=teta1g(indmax2)
%for the saddle point part of the array Ir is used
Irsaddle=Ir(indmax1:indmax2);
[minS,indS]=min(Irsaddle)
%indS is the position from indmax1!!!
%corresponding angular position of the saddle point
teta1S=teta1g(indmax1:indmax2);
angS=teta1S(indS);
%
%=============================================
%check of the ratio of intensities for the
%saddle point with expected value 8/(pi^2)
%=============================================
%
%the ratio between minS and maxIr1 or maxIr2
saddle1=minS/maxIr1
check=8/(pi^2)
%=================================================
%check of position of the minimum of Ir2 to the
%left of its maximum
%=================================================
%
%we search the position ind2p into the array Ir2
%of first secondary maximum of Ir2 (to the left of the primary maximum)
%between the elements 1 and indmax1
Ir2p=Ir2(1:indmax1);
[max2p,ind2p]=max(Ir2p);
%and corresponding angular position teta12pg
teta12p=teta1g(1:indmax1);
teta12pg=teta12p(ind2p);
%we search the position of the second minimum of Ir2
%next to its primary maximum
%part of the array Ir2 between ind2p and ind2pS=indmax1+indS
ind2pS=indmax1+indS;
Ir22=Ir2(ind2p:ind2pS);
[min2L,ind2L]=min(Ir22);
%ind2L is the position from ind2p
%its position from the beginning is
indmin2=ind2L+ind2p
%
%corresponding angle
angmin2=teta1g(indmin2)
%
%=================================================
%check of position of the minimum of Ir1 to the
%right of its maximum
%=================================================
%
%it is used part of Ir1 between position ind2pS
%(that of the saddle point from the beginning)
%and ind1S=indmax2+indS
%the extension of indS to indmax2 is reasonable
ind1S=indmax2+indS;
Ir11=Ir1(ind2pS:ind1S);
[min11,indmin11]=min(Ir11);
%indmin1 is the position from ind2pS
%its position from the beginning is
indmin1=ind2pS+indmin11
%corresponding angle is
angmin1=teta1g(indmin1)
%=================================================
%
Top