diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-04-13 10:51:05 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-04-13 10:51:05 -0400 |
commit | 5fd9b5510e7a00295e6e6184a2e73953a2b182ab (patch) | |
tree | 0b792346a57aafefc5708015db45904f1ea2cdc2 /cavity | |
parent | 8dc8b38794731c43e5a9a7e65174370504a9e15f (diff) | |
download | mode_match-5fd9b5510e7a00295e6e6184a2e73953a2b182ab.tar.gz mode_match-5fd9b5510e7a00295e6e6184a2e73953a2b182ab.zip |
moved cavity calculations to separate folder
Ignore-this: b94054824a279aa64b0da28d0cc41bf9
darcs-hash:20110413145105-067c0-44e9a3c8220b834fe364debabeac7495e1533e44
Diffstat (limited to 'cavity')
-rw-r--r-- | cavity/cavity.m | 21 | ||||
-rw-r--r-- | cavity/cavity_q_parameter_at_mirror.example.m | 18 | ||||
-rw-r--r-- | cavity/cavity_q_parameter_at_mirror_for_532nm.example.m | 18 |
3 files changed, 57 insertions, 0 deletions
diff --git a/cavity/cavity.m b/cavity/cavity.m new file mode 100644 index 0000000..0e38d07 --- /dev/null +++ b/cavity/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 + + diff --git a/cavity/cavity_q_parameter_at_mirror.example.m b/cavity/cavity_q_parameter_at_mirror.example.m new file mode 100644 index 0000000..4c3f8a3 --- /dev/null +++ b/cavity/cavity_q_parameter_at_mirror.example.m @@ -0,0 +1,18 @@ +source("abcd.m") +source("cavity.m") + +lambda=1.064e-6 +R1=.01 +R2=.01 + +cavity_abcd = abcd_lens(R1/2) * abcd_free_space(.007) * abcd_free_space(.01/1.8) * abcd_free_space(0.0036) + +global A = cavity_abcd(1,1) +global B = cavity_abcd(1,2) +global C = cavity_abcd(2,1) +global D = cavity_abcd(2,2) + +q_at_mirror=find_q_at_the_mirror(1/R1+3i) +w_at_mirror=q2waste(q_at_mirror,lambda) +R_at_mirror=q2radius(q_at_mirror,lambda) + diff --git a/cavity/cavity_q_parameter_at_mirror_for_532nm.example.m b/cavity/cavity_q_parameter_at_mirror_for_532nm.example.m new file mode 100644 index 0000000..1b7d43b --- /dev/null +++ b/cavity/cavity_q_parameter_at_mirror_for_532nm.example.m @@ -0,0 +1,18 @@ +source("abcd.m") +source("cavity.m") + +lambda=.532e-6 +R1=.01 +R2=.01 + +cavity_abcd = abcd_lens(R1/2) * abcd_free_space(.007) * abcd_free_space(.01/1.8) * abcd_free_space(0.0036) + +global A = cavity_abcd(1,1) +global B = cavity_abcd(1,2) +global C = cavity_abcd(2,1) +global D = cavity_abcd(2,2) + +q_at_mirror=find_q_at_the_mirror(1/R1+3i) +w_at_mirror=q2waste(q_at_mirror,lambda) +R_at_mirror=q2radius(q_at_mirror,lambda) + |