summaryrefslogtreecommitdiff
path: root/gbeam_propagation.m
diff options
context:
space:
mode:
authorMatt Argao <mcargao@email.wm.edu>2012-11-29 16:55:14 -0500
committerMatt Argao <mcargao@email.wm.edu>2012-11-29 16:55:14 -0500
commit91a5cf152b0f7c04d40ef5cb1634eeff330989ad (patch)
treeaaf7767fd53f7b71a217c34448418709d200ce0e /gbeam_propagation.m
parente88386747ced3b121c23a6afdad2bc1f2ef362ab (diff)
downloadmode_match-91a5cf152b0f7c04d40ef5cb1634eeff330989ad.tar.gz
mode_match-91a5cf152b0f7c04d40ef5cb1634eeff330989ad.zip
Prearrange optics for backward propagation
Diffstat (limited to 'gbeam_propagation.m')
-rw-r--r--gbeam_propagation.m8
1 files changed, 5 insertions, 3 deletions
diff --git a/gbeam_propagation.m b/gbeam_propagation.m
index 71fcb74..d81f70e 100644
--- a/gbeam_propagation.m
+++ b/gbeam_propagation.m
@@ -22,11 +22,13 @@ function q = gbeam_propagation(x_pos, q_in, x_in, optics_elements)
x_backw=fliplr(x_backw);
% reflected beam means inverted radius of curvature or real part of q parameter
q_in_backw = -real(q_in) + 1i*imag(q_in);
- optics_elements_backw=optics_elements;
+ optics_elements_backw=fliplr(optics_elements);
% we need to flip all optics elements around x_in as well
- for i=1:length(optics_elements_backw)
+ n_elements = length(optics_elements);
+
+ for i=1:n_elements
optics_elements_backw{i}.x=x_in-optics_elements_backw{i}.x;
- % there is a tricky case: if position of any optics element coincides
+ % there is a tricky case: if position of any optics element coincides
% with x_in i.e it is 0 in backwards x coordinates (or at index 1) then
% we need to apply abcd matrix of that element in advance.
if ( optics_elements_backw{i}.x == 0)