summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-04-14 10:01:51 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2011-04-14 10:01:51 -0400
commit48c490b71eadf20187c93c1541dda3e40843dcce (patch)
tree6aed8ac79f92749333576757ec0af5d1e07ba0c8
parent621aff7d0168de6ae2f127e14edfde7d526baf69 (diff)
downloadmode_match-48c490b71eadf20187c93c1541dda3e40843dcce.tar.gz
mode_match-48c490b71eadf20187c93c1541dda3e40843dcce.zip
functions from abcd.m now in separate files
Ignore-this: 33d046a6087834ae6c896966261af8e3 darcs-hash:20110414140151-067c0-7ee6687ce86608989ad7b9b2b1db276c7c11dbc2
-rw-r--r--abcd.m51
-rw-r--r--abcd_free_space.m6
-rw-r--r--abcd_lens.m6
-rw-r--r--arrange_optics_along_x.m19
-rw-r--r--q2wr.m7
-rw-r--r--q_after_abcd.m6
-rw-r--r--solution_visualization.m1
-rw-r--r--wr2q.m5
8 files changed, 50 insertions, 51 deletions
diff --git a/abcd.m b/abcd.m
deleted file mode 100644
index 20ae061..0000000
--- a/abcd.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function fs_abcd = abcd_free_space( distance)
- fs_abcd=[1, distance; 0,1];
-endfunction
-
-function lens_abcd =abcd_lens(focal_distance)
- lens_abcd = [1, 0; -1/focal_distance, 1];
-endfunction
-
-function qnew=q_after_abcd(q_old,abcd)
- qnew=(q_old*abcd(1,1)+abcd(1,2))/(q_old*abcd(2,1)+abcd(2,2));
-endfunction
-
-
-function optics = arrange_optics_along_x(optics_unsorted)
-% arrange optics in proper order so its x position increases with consequent index
- N=length(optics_unsorted);
-
- % assign x positions
- x=zeros(1,N);
- for i=1:N
- x(i)=optics_unsorted{i}.x;
- end
-
- [xs,indx]=sort(x);
- cntr=1;
- for i=indx
- optics{cntr}=optics_unsorted{i};
- cntr=cntr+1;
- end
-end
-
-
-
-
-function [waste,radius] =q2wr(q, lambda)
-% convert Gaussian beam q parameter to waste and radius
- waste=sqrt (-lambda./pi./imag(1./q));
- radius=(1./real(1./q));
-endfunction
-
-
-function q=wr2q(waste,R,lambda)
-% convert Gaussian beam waste and radius to q parameter
- q=1./(1./R-1i.*lambda./pi./(waste.^2));
-endfunction
-
-
-
-
-
-
diff --git a/abcd_free_space.m b/abcd_free_space.m
new file mode 100644
index 0000000..e6af144
--- /dev/null
+++ b/abcd_free_space.m
@@ -0,0 +1,6 @@
+function fs_abcd = abcd_free_space( distance)
+% abcd matrix for the free space region of given distance
+ fs_abcd=[1, distance; 0,1];
+endfunction
+
+
diff --git a/abcd_lens.m b/abcd_lens.m
new file mode 100644
index 0000000..55c23bd
--- /dev/null
+++ b/abcd_lens.m
@@ -0,0 +1,6 @@
+function lens_abcd =abcd_lens(focal_distance)
+% abcd matrix of the lens with given focal length
+ lens_abcd = [1, 0; -1/focal_distance, 1];
+endfunction
+
+
diff --git a/arrange_optics_along_x.m b/arrange_optics_along_x.m
new file mode 100644
index 0000000..62db960
--- /dev/null
+++ b/arrange_optics_along_x.m
@@ -0,0 +1,19 @@
+function optics = arrange_optics_along_x(optics_unsorted)
+% arrange optics in proper order so its x position increases with consequent index
+ N=length(optics_unsorted);
+
+ % assign x positions
+ x=zeros(1,N);
+ for i=1:N
+ x(i)=optics_unsorted{i}.x;
+ end
+
+ [xs,indx]=sort(x);
+ cntr=1;
+ for i=indx
+ optics{cntr}=optics_unsorted{i};
+ cntr=cntr+1;
+ end
+end
+
+
diff --git a/q2wr.m b/q2wr.m
new file mode 100644
index 0000000..9257448
--- /dev/null
+++ b/q2wr.m
@@ -0,0 +1,7 @@
+function [waste,radius] =q2wr(q, lambda)
+% convert Gaussian beam q parameter to waste and radius
+ waste=sqrt (-lambda./pi./imag(1./q));
+ radius=(1./real(1./q));
+endfunction
+
+
diff --git a/q_after_abcd.m b/q_after_abcd.m
new file mode 100644
index 0000000..fd1f905
--- /dev/null
+++ b/q_after_abcd.m
@@ -0,0 +1,6 @@
+function qnew=q_after_abcd(q_old,abcd)
+% calculates q parameter after propagating through element with given abcd matrix
+ qnew=(q_old*abcd(1,1)+abcd(1,2))/(q_old*abcd(2,1)+abcd(2,2));
+endfunction
+
+
diff --git a/solution_visualization.m b/solution_visualization.m
index b26e13c..a47d27c 100644
--- a/solution_visualization.m
+++ b/solution_visualization.m
@@ -1,3 +1,4 @@
+source('abcd.m');
source('answ.txt');
diff --git a/wr2q.m b/wr2q.m
new file mode 100644
index 0000000..50b2ad7
--- /dev/null
+++ b/wr2q.m
@@ -0,0 +1,5 @@
+function q=wr2q(waste,R,lambda)
+% convert Gaussian beam waste and radius to q parameter
+ q=1./(1./R-1i.*lambda./pi./(waste.^2));
+endfunction
+