diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-27 17:26:04 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-27 17:26:04 -0400 |
commit | 5c764b58723425122274b4576ce95df329609603 (patch) | |
tree | 440725d76d37ea14087e26313e30c1e74d79fb7f | |
parent | 21ad89349d9f799ff6dfb9828d915797dd964e07 (diff) | |
download | mode_match-5c764b58723425122274b4576ce95df329609603.tar.gz mode_match-5c764b58723425122274b4576ce95df329609603.zip |
proper way to find location of the waist in the cavity
-rw-r--r-- | cavity_optics2its_waist_and_position.m | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cavity_optics2its_waist_and_position.m b/cavity_optics2its_waist_and_position.m new file mode 100644 index 0000000..360f8c1 --- /dev/null +++ b/cavity_optics2its_waist_and_position.m @@ -0,0 +1,41 @@ +function [w0, z0] = cavity_optics2its_waist_and_position( cavity_optics, lambda ) + +abcd_cavity = optics2abcd( cavity_optics ); +cavity_length = cavity_optics{end}.x; +N=length(cavity_optics); + +if ~isCavityStable(abcd_cavity) + display('Cavity is unstable !'); + display('We should stop now. There is no stable mode in this cavity'); + error('Not possible to calculate a cavity mode in the unstable cavity'); +end + +zstart = 0; +qstart = abcd2self_repeating_q( abcd_cavity ); + +% waist location of this particular Gaussian beam +% which disregards other optical elements +z0 = - real (qstart); + +i = 1; +if ( (z0 > cavity_optics{1}.x) || (z0 < 0) ) + % waist is to the left of the cavity or beyond first reflective/refractive element + % we need to swap cavity elements by one + % in attempt to find waist in between optics elements + x1 = cavity_optics{i}.x; + for i=2:N + cavity_optics_transpose{i-1} = cavity_optics{ i }; + cavity_optics_transpose{i-1}.x = cavity_optics{ i }.x - x1; + end + cavity_optics_transpose{N} = cavity_optics{1}; + cavity_optics_transpose{N}.x = cavity_length; + [w0, z0] = cavity_optics2its_waist_and_position( cavity_optics_transpose, lambda ); + z0 = cavity_optics{1}.x + z0; +else + q0 = gbeam_propagation ( z0, qstart, zstart, cavity_optics ); + [w0, r0 ] = q2wr( q0, lambda ); +end + + +end + |