% this file plots rays backwards through a set of lenses % this is used to determine the image space principle plane % this file uses the functions % free_space_b.m % lens.m global xx yy a1 clf hold 'on' ho=1; %the object height %lens focal lengths f1=50; f2=16.67; %spacings between elements xo=50; x1=25; x2=20; %the position/focal length array xf=[xo,f1,x1,f2,x2]; %the type of each element in the array type=['x', 'f', 'x', 'f', 'x']; lens_h=2; % this is the height of the line plotted for each lens %ray 1 aa1=[ho;0]; %ray 2 aa2=[-ho;0]; %ray 1 a1=aa1; xx=0; yy=a1(1); for lp=length(xf):-1:1 if type(lp) == 'x' free_space_b(xf(lp)) elseif type(lp) == 'f' lens(xf(lp)) plot([xx(end), xx(end)], [-lens_h, lens_h],'k') end end plot(xx,yy) plot([0, max(xx)], [0,0],'k:') %ray 2 a1=aa2; xx=0; yy=a1(1); for lp=length(xf):-1:1 if type(lp) == 'x' free_space_b(xf(lp)) elseif type(lp) == 'f' lens(xf(lp)) end end plot(xx,yy) hold 'off'