diff options
author | evmik <evmik@ligo.mit.edu> | 2006-07-10 15:13:57 -0400 |
---|---|---|
committer | evmik <evmik@ligo.mit.edu> | 2006-07-10 15:13:57 -0400 |
commit | 3bcd281d73cc58184664e0fe4e16cc5888d82692 (patch) | |
tree | 539c44ffb219869fcdb3dc0aee705af4a19045f5 /cavity.m | |
parent | 786b4e0ece4249b92058faff8d1ac85644ad99eb (diff) | |
download | mode_match-3bcd281d73cc58184664e0fe4e16cc5888d82692.tar.gz mode_match-3bcd281d73cc58184664e0fe4e16cc5888d82692.zip |
Added code to solve waise parameters of the cavity
darcs-hash:20060710191357-a6199-8087f094f9bb07466a82c4da5412e3ac9928a8d6
Diffstat (limited to 'cavity.m')
-rw-r--r-- | cavity.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cavity.m b/cavity.m new file mode 100644 index 0000000..0e38d07 --- /dev/null +++ b/cavity.m @@ -0,0 +1,21 @@ +function answ=q_diff_after_cavity(q_initial) + # A B C D should be defined as global variables outside as well + # they represent elements of cavity ABCD matrix + global A B C D ; + q_diff=(A*(q_initial(1)+q_initial(2)*1i)+B)/(C*(q_initial(1)+q_initial(2)*1i) +D)-(q_initial(1)+q_initial(2)*1i) ; + answ=[real(q_diff), imag(q_diff)]; +endfunction + + +## looks like it always return some result even if cavity is unstable ## +function answ=find_q_at_the_mirror(q_initial_guess) + [q_array,info]=fsolve("q_diff_after_cavity", [real(q_initial_guess),imag(q_initial_guess)]); + if ( info == 1 ) + answ=q_array(1)+q_array(2)*1i ; + else + error("unable to find waste at mirror of the cavity, may be cavity is unstable") + quit() + endif +endfunction + + |