function fs_abcd = abcd_free_space( distance) fs_abcd=[1, distance; 0,1]; endfunction function lens_abcd =abcd_lens(focal_distance) lens_abcd = [1, 0; -1/focal_distance, 1]; endfunction function qnew=q_afteer_element(q_old,abcd) qnew=(q_old*abcd(1,1)+abcd(1,2))/(q_old*abcd(2,1)+abcd(2,2)); endfunction function q = prop(x_final, q_in, elements) q(size(x_final,2))=0; for i=1:size(x_final,2) x_final_i=x_final(i); xend=0; q_end=q_in; for k=1:size(elements,2) el=nth(elements,k); if ( el.x <= x_final_i) abcd=abcd_free_space(el.x-xend); q_end=q_afteer_element(q_end,abcd); q_end=q_afteer_element(q_end,el.abcd); xend=el.x; endif endfor if (x_final_i > xend); abcd=abcd_free_space(x_final_i-xend); q_end=q_afteer_element(q_end,abcd); xend=x_final_i; endif q(i)=q_end; endfor endfunction function waste =q2waste(q, lambda) for i=1:size(q,2) waste(i)=sqrt (-lambda/pi/imag(1/q(i))); endfor endfunction function radius =q2radius(q, lambda) for i=1:size(q,2) radius(i)=(1/real(1/q(i))); endfor endfunction function q=waste_r2q(waste,R,lambda) q=1/(1/R-I*lambda/pi/waste/waste); endfunction