aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-04-13 11:06:02 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2011-04-13 11:06:02 -0400
commit855e0053c56bbe2555e87b180f3bf3f3ecccf121 (patch)
tree31dace131ef8680a6cef3298c0c857c9188a393f
parentbe8a8f187a4eb3b274a951e6b8c3290d228604c4 (diff)
downloadmode_match-855e0053c56bbe2555e87b180f3bf3f3ecccf121.tar.gz
mode_match-855e0053c56bbe2555e87b180f3bf3f3ecccf121.zip
extra comments
Ignore-this: 24148ddf66f49e2b8c4f02186a8dbc3b darcs-hash:20110413150602-067c0-b7e0f6ccfca349018b313e5ac53859557e189582
-rw-r--r--abcd.m41
1 files changed, 22 insertions, 19 deletions
diff --git a/abcd.m b/abcd.m
index 7e02200..ac9b1db 100644
--- a/abcd.m
+++ b/abcd.m
@@ -10,12 +10,32 @@ 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 optics = arrange_optics_along_x(optics_unsorted)
+% arrange optics in proper order so it x position increases with number
+ N=length(optics_unsorted);
+
+ % assign x positions
+ x=zeros(1,N);
+ for i=1:N
+ x(i)=optics_unsorted{i}.x;
+ end
+
+ [xs,indx]=sort(x);
+ cntr=1;
+ for i=indx
+ optics{cntr}=optics_unsorted{i};
+ cntr=cntr+1;
+ end
+end
+
function q = prop_forward(x_pos, q_in, x_in, optics_elements)
% calculate the 'q' parameter of the Gaussian beam propagating through optical
-% 'optics_elements' array along 'x' axis at points 'x_pos'
+% 'optics_elements' only in the positive direction along 'x' axis at points 'x_pos'
% takes the gaussian beam with initial q_in parameter at x_in
%
% all x_pos must be to the right of x_in
+% x_pos must be monotonic!
if (any(x_pos < x_in))
error('all beam positions must be to the right of the x_in');
end
@@ -50,28 +70,11 @@ function q = prop_forward(x_pos, q_in, x_in, optics_elements)
endfor
end
-function optics = arrange_optics_along_x(optics_unsorted)
-% arrange optics in proper order so it x position increases with number
- N=length(optics_unsorted);
-
- % assign x positions
- x=zeros(1,N);
- for i=1:N
- x(i)=optics_unsorted{i}.x;
- end
-
- [xs,indx]=sort(x);
- cntr=1;
- for i=indx
- optics{cntr}=optics_unsorted{i};
- cntr=cntr+1;
- end
-end
-
function q = prop(x_pos, q_in, x_in, optics_elements)
% calculate the 'q' parameter of the Gaussian beam propagating through optical
% 'optics_elements' array along 'x' axis at points 'x_pos'
% takes the gaussian beam with initial q_in parameter at x_in
+% x_pos must be monotonic!
q=0*x_pos; % q vector initialization