summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2013-09-27 10:49:39 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2013-09-27 10:49:39 -0400
commitc47f0765ceaf5a60f4e7144a56f7e498be2cce8a (patch)
tree3a0eb5de0a3620bdc08df2850ac4e9dadbb6c077
parent46401075a95e758a946ca2abb5fbe0cf9219a744 (diff)
downloadmode_match-c47f0765ceaf5a60f4e7144a56f7e498be2cce8a.tar.gz
mode_match-c47f0765ceaf5a60f4e7144a56f7e498be2cce8a.zip
abcd2self_repeating_q function added
-rw-r--r--abcd2self_repeating_q.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/abcd2self_repeating_q.m b/abcd2self_repeating_q.m
new file mode 100644
index 0000000..cd60aaf
--- /dev/null
+++ b/abcd2self_repeating_q.m
@@ -0,0 +1,19 @@
+function [q] = abcd2self_repeating_q( abcd_cavity )
+% this find q such that q = (A*q+B)/(C*q+D)
+% i.e q after abcd is exactly the same
+% very handy for cavity mode calculations
+
+% spelling out abcd coefficients
+[A, B, C, D] = abcd2ABCD( abcd_cavity );
+
+if ~isCavityStable(abcd_cavity)
+ display('ABCD is unstable !');
+ display('We should stop now. There is no stable self-repeating mode with such ABCD');
+ error('Not possible to calculate a self-repeating mode with the unstable ABCD');
+end
+
+% q is the solution of quadratic equation, we chose one with positive waist size
+q = ( -(D-A) - sqrt( (D-A)^2 + 4*C*B ) ) / (2*C);
+
+end
+