Home

Introduction

Contents

Scripts

FeedBack

Date 08/09/2010
Script S4_2_1.m
Download Script S4_2_1.m
%==============================================
%A thin film on a lens
%==============================================
%
%refractive indices
%of air
n0=1;
%of the lens
n2=1.85;
%a variable refractive index for the layer
%
%............................................
%a graphical approach
%............................................
%
m=50;
n1=linspace(1,1.85,m);
%preliminary calculi for reflectivities
num1=(n1-n0);
den1=(n1+n0);
num2=(n2-n1);
den2=(n2+n1);
%reflectivity on the surface between air and layer
R1=num1./den1;
%reflectivity on the surface between layer and lens
R2=num2./den2;
%theis plots function of the refractive index of the layer
plot(n1,R1,'ro-', n1,R2,'bd-'),grid on
title('Reflectivity bewteen surfaces air-layer (red) and layer-lens(blue)')
axis([1 1.85 0 0.3])
%
%............................................
%a numerical approach
%............................................
%
m1=10000;
n11=linspace(1,1.85,m1);
num11=(n11-n0);
den11=(n11+n0);
num22=(n2-n11);
den22=(n2+n11);
R11=num11./den11;
R22=num22./den22;
for i=1:m1
diff(i)=abs(R11(i)-R22(i));
end
[val,ind]=min(diff)
n=n11(ind)
%the best value for refractive index of the layer
%is 1.3602
%found in the position ind = 4238
%where the difference diff between the two reflectivities
%is about 0.00002
%==============================================
%
Top