Home

Introduction

Contents

Scripts

FeedBack

Date 06/09/2010
Script S2_2_21A.m
Download Script S2_2_21A.m
%==============================================
%Three coaxial lensesA
%==============================================
%
%==============================================
%==============================================
%CORRIGENDA
%In the last row of text (pag. 105)
%change "modification" with "modifications"
%==============================================
%==============================================
%
%values to d and y1 are assigned so that teta1 is a paraxial angle (<20°
%with an error less than 2%)
d=130;
z1=-d;
y1=10
%teta1 is assumed negative
teta1=-y1/d
teta1g=teta1*180/pi
%
%f is defined in the interval 40-90 degrees
f1=40:5:90
%number of elements of the array f1
max=length(f1)
%an array of max rows and 11 columns is defined;
%it will be redefined by the next instructions
F=zeros(max,11);
%
%==============================================
%values of z2,z3,z4,teta2g,y2,teta3g,y3,teta4g
%are calculated by the next commands for every
%of max values of focal lengths
for i=1:max
f=f1(i);
%
%the ray crosses the first lens
a1=[1 0;1/f 1];
a2=[y1;teta1];
A=a1*a2;
%teta2 is calculated
teta2=A(2);
teta2g=teta2*180/pi;
%z2 is point image for the first lens
z2=A(1)/A(2);
%
%the ray goes from the first to the second
%teta2 is assumed negative
b1=[1 d;0 1];
b2=[y1;-teta2];
B=b1*b2;
%y2 is calculated
y2=B(1);
%
%the ray crosses the second lens
%teta2 is now positive
c1=[1 0;1/f 1];
c2=[y2;teta2];
C=c1*c2;
z3=C(1)/C(2);
teta3=C(2);
teta3g=teta3*180/pi;
%
%the ray goes from the second to the third
%teta3 is assumed negative
d1=[1 d;0 1];
d2=[y2;-teta3];
D=d1*d2;
y3=D(1);
%
%%the ray crosses the third lens
%teta3 is now positive
e1=[1 0;1/f 1];
e2=[y3;teta3];
E=e1*e2;
teta4=E(2);
%teta4 in degrees
teta4g=teta4*180/pi;
%the final point image
z4=E(1)/E(2);
%the previous values are allocated in a row of the array F
%the last two values are the final angular and transverse magnifications
F(i,:)=[f,z2,z3,z4,teta2g,y2,teta3g,y3,teta4g,teta4g/teta1g,z4/z1];
end
%the array F is now full
F
%
%plot of the point images after first(red circle)-second(blue diamond)-
%third(magenta square) lens varying the focal length
plot(f1,F(:,2),'ro-',f1,F(:,3),'bd-',f1,F(:,4),'ms-'),grid on
title('images after first(red circle) second(blue diamond) third(magenta square) lens varying f')
axis([59 71 -50 200])
%==============================================
%
Top
Script S2_2_21B.m
Download Script S2_2_21B.m
%==============================================
%Three coaxial lensesB
%==============================================
%
%standard formulae are used in a recursive way
%the initial distance d of the object from the first lens
d=130;
%N is the number of the lenses used
N=3;
f=[60,65,70];
%m is the number of the focal lengths
m=length(f);
for i=1:m;
%for assigned focal length i
a=0;
%for assigned lens j
for j=1:N;
z1(i,j)=a-d;
z2(i,j)=(f(i)*z1(i,j))/(f(i)+z1(i,j));
a=z2(i,j);
end
%all lenses are considered
end
%all focal lengths are considered
%==============================================
%
%z1 is an array of m (number of f) rows and N (number of lenses) columns
%containing in each row the distances of point objects for each lens
z1
%z2 is an array of m (number of f) rows and N (number of lenses) columns
%containing in each row the distances of point images for each lens
z2
%F60 is an array of two rows and three columns
%first row contains the objects distances when f = 60
%the second row contains the images distances when f = 60
F60=[z1(1,:);z2(1,:)]
%and so when f = 65
F65=[z1(2,:);z2(2,:)]
%or f = 70
F70=[z1(3,:);z2(3,:)]
%plot of the point images after first(red diamond)-second(blue asterisk)-
%third(magenta circle) lens varying the focal length
plot(f,z2(:,1),'rd-',f,z2(:,2),'b-*',f,z2(:,3),'m-o'),grid on
title('images after first(red diamond) second(blue asterisk) third(magenta circle) lens varying f')
axis([59 71 -50 200])
%==================================================
%
Top