Home

Introduction

Contents

Scripts

FeedBack

Date 06/09/2010
Script S1_2_16.m
Download Script S1_2_16.m
%==============================================
%Two mirrors
%use the numeric format longE
%from Preferences/Command Window
%==============================================
%
%a set of fine values of lambda in the visible range are defined
lambda=0.4:0.003:0.70;
%max0 is the number of elements in the array lambda
max0=length(lambda)
%
%ro is the reflectivity and ep its square root
r=0.95
ep=sqrt(r)
%the distance between the mirrors is set to 15 cm written in micron
d=1.50e+05
%we define int using the resonance condition
%that would be integers
int=2*(d./lambda);
%
%-------------------------------------------------------------
% A loop
%between the max0 values of int to search m values
%with the corresponding values of lambda (to be called mlambda)
%that are really integers and differs from int
%of a value dec equal to zero
%-------------------------------------------------------------
v=int;
vr=round(v);
vf=fix(v);
diff=vr-vf;
j=0;
for i=1:max0
if diff(i)==0
v10(i)=v(i)*10;
fv10(i)=fix(v10(i));
modv(i)=mod(fv10(i),10);
if modv(i)==0
j=j+1;
m(j)=fv10(i)/10;
mlambda(j)=lambda(i);
reale(j)=int(i);
end
end
end
%-------------------------------------------------------------
%end of the loop
%-------------------------------------------------------------
%operation to find dec
diffrm=reale-m;
diffx100=diffrm*100;
roundreale=round(diffx100);
dec=roundreale/100;
%
%with m and mlambda found in the loop
m;
mlambda;
%the number of elements in the arrays dec, m, mlambda
max=length(m)
%-------------------------------------------------------------
%
%the relative intensity Ir is calculated
%value of fi
fi=(4*pi*d)./mlambda;
ang=fi*180/pi;
%fig is the value of fi in degrees extended in the range 0-360
fig=mod(ang,360);
denb=-2*ep*cos(fi);
dena=1+r;
den=dena+denb;
Ir=1./den;
%
%----------------------------------------------------
%the array val with max rows and 5 columns contains
%the values lambda, m, dec, figrado and Ir
val=[mlambda' m' dec' fig' Ir']
%---------------------------------------------------
%
%plot of relative intensity varying lambda from 0.4 to 0.7 micron
%
plot(mlambda,Ir,'r-o'),grid on
title('relative intensity when ro=0.95 and lambda varies from 0.4 to 0.7 micron')
axis([0.38 0.72 0 1600])
Top