function [p,q,r,s,v,w,f1,f2] = Two_Thin_Lenses(FF1,FF2,LL) % % [p,q,r,s,v,w,f1,f2] = Two_Thin_Lenses(FF1,FF2,LL) % % Calculate cardinal points from A, B, C, D % % It calculates symbolically the A, B, C, D (it needs symbolic Toolbox) % and the it determines the numerical values % % Input: % % FF1 = Focal distance of left thin lens (mm) % FF2 = Focal distance of right thin lens (mm) % LL = Lenses distance (mm) % % Output: p,q,r,s,v,w,f1,f2 (all in mm) % % % Determine symbilically the A, B, C, D elements % syms f1 f2 L M1 = [1 0; -1/f1 1]; M2 = [1 L; 0 1]; M3 = [1 0; -1/f2 1]; MM = M3*M2*M1; ABCD = simple(MM) AA = MM(1,1); AA = simple(AA); BB = MM(1,2); BB = simple(BB); CC = MM(2,1); CC = simple(CC); DD = MM(2,2); DD = simple(DD); A = subs(AA,{f1,f2,L},{FF1,FF2,LL}); B = subs(BB,{f1,f2,L},{FF1,FF2,LL}); C = subs(CC,{f1,f2,L},{FF1,FF2,LL}); D = subs(DD,{f1,f2,L},{FF1,FF2,LL}); ABCD_num = [A B; C D] p = D/C; q = -A/C; r = (D-1)/C; s = (1-A)/C; v = (D-1)/C; w = (1-A)/C; f1 = 1/C; f2 = -1/C;