diff options
author | Matt Argao <mcargao@email.wm.edu> | 2012-11-29 16:55:14 -0500 |
---|---|---|
committer | Matt Argao <mcargao@email.wm.edu> | 2012-11-29 16:55:14 -0500 |
commit | 91a5cf152b0f7c04d40ef5cb1634eeff330989ad (patch) | |
tree | aaf7767fd53f7b71a217c34448418709d200ce0e /gbeam_propagation.m | |
parent | e88386747ced3b121c23a6afdad2bc1f2ef362ab (diff) | |
download | mode_match-91a5cf152b0f7c04d40ef5cb1634eeff330989ad.tar.gz mode_match-91a5cf152b0f7c04d40ef5cb1634eeff330989ad.zip |
Prearrange optics for backward propagation
Diffstat (limited to 'gbeam_propagation.m')
-rw-r--r-- | gbeam_propagation.m | 8 |
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) |