Home

Introduction

Contents

Scripts

FeedBack

Date 08/09/2010
Script S2_2_1.m
Download Script S2_2_1.m
%==============================================
%Simple thin biconvex lens
%the function flens is used
%==============================================
%
%the focal length
f=15;
%max distances of the point object
zz=-30:1:30;
max=length(zz);
%corresponding values of zp (distances of the point image)
%and mt (transverse magnification)
%using the function flens
for i=1:max
k(i)=i;
z=zz(i);
A=flens(f,z);
zp(i)=A(1);
mt(i)=A(2);
end
%the array matr of max rows and 4 columns contains
%a counter k, zz, zp and mt
matr=[k' zz' zp' mt']
%
%plot of zp and mt function of the distance z
subplot(2,1,1)
plot(zz,zp,'ro-'),grid on
title('distance of the point image function of the distance point object')
axis([-30 30 -100 100])
subplot(2,1,2)
plot(zz,mt,'bd-'),grid on
title('transverse magnification function of the distance point object')
axis([-30 30 -8 8])
%==============================================
%
Top
Function flens.m
Download Funzione flens.m
%==============================================
%function flens
%is necessary to run the script
%Simple thin biconvex lens
%==============================================
%
%==============================================
function F=flens(f,z)
a=f*z;
b=z+f;
%we check that isn't z=-f. This value would give
%zp = a/b = infinite
%if z=-f, zp=10^4 is assumed
zp=1.0e+04;
if b~=0
zp=a/b;
end
%we check that isn't z = 0
%This value woul give also zp = 0 and hence mt=0/0
%If z = 0, mt=1 is assumed
mt=1;
if z~=0
mt=zp/z;
end
%in ris are place zp and mt
ris=[zp,mt];
F=ris;
%==============================================
%
Top