aboutsummaryrefslogtreecommitdiff
path: root/gbeam_propagation_froward_only.m
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-04-13 11:10:28 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2011-04-13 11:10:28 -0400
commite75e6f968d620fde5d5596092e6c6b0f2cc4aa94 (patch)
tree687bdfc42ff71a588e2bfb7208df78747914c99e /gbeam_propagation_froward_only.m
parent855e0053c56bbe2555e87b180f3bf3f3ecccf121 (diff)
downloadmode_match-e75e6f968d620fde5d5596092e6c6b0f2cc4aa94.tar.gz
mode_match-e75e6f968d620fde5d5596092e6c6b0f2cc4aa94.zip
beam propagation function renamed and moved to separate files
Ignore-this: 972fa9dce2f57e8ddb1624bab32be1ed darcs-hash:20110413151028-067c0-a7e6d0c98e2856fdff930d4bf3216056eb937367
Diffstat (limited to 'gbeam_propagation_froward_only.m')
-rw-r--r--gbeam_propagation_froward_only.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/gbeam_propagation_froward_only.m b/gbeam_propagation_froward_only.m
new file mode 100644
index 0000000..ba8c1cf
--- /dev/null
+++ b/gbeam_propagation_froward_only.m
@@ -0,0 +1,40 @@
+function q = gbeam_propagation_froward_only(x_pos, q_in, x_in, optics_elements)
+% calculate the 'q' parameter of the Gaussian beam propagating through optical
+% '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
+
+ optics_elements=arrange_optics_along_x(optics_elements);
+
+ % Forward propagation to the right of x_in
+ Np=length(x_pos); % number of 'x' points
+ Nel=length(optics_elements) ;
+ q=0*x_pos; % q vector initialization
+ q_last_calc=q_in;
+ x_last_calc=x_in; % the furthest calculated point
+ for i=1:Np
+ x_pos_i=x_pos(i);
+ for k=1:length(optics_elements)
+ % iterates through optics_elements to make sure
+ % we take them in account for the beam propagation
+ el=optics_elements{k};
+ if ( (x_last_calc < el.x) && (el.x <= x_pos_i) )
+ abcd=abcd_free_space(el.x-x_last_calc);
+ q_last_calc=q_afteer_element(q_last_calc,abcd);
+ q_last_calc=q_afteer_element(q_last_calc,el.abcd);
+ x_last_calc=el.x;
+ endif
+ endfor
+ if (x_pos_i > x_last_calc);
+ abcd=abcd_free_space(x_pos_i-x_last_calc);
+ q_last_calc=q_afteer_element(q_last_calc,abcd);
+ x_last_calc=x_pos_i;
+ endif
+ q(i)=q_last_calc;
+ endfor
+end