summaryrefslogtreecommitdiff
path: root/psr/basis_transformation.m
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2010-06-16 18:00:03 +0000
committerEugeniy Mikhailov <evgmik@gmail.com>2010-06-16 18:00:03 +0000
commit9709621e8c71e9a86cd6e3e47edc3d8b8e6becd9 (patch)
tree0693c4783bf81abb865bd2637b60497b1391ce54 /psr/basis_transformation.m
parentae3f51976a745241396e98aef58933637485d787 (diff)
downloadmulti_mode_eit-9709621e8c71e9a86cd6e3e47edc3d8b8e6becd9.tar.gz
multi_mode_eit-9709621e8c71e9a86cd6e3e47edc3d8b8e6becd9.zip
this code is for PSR calculation, added pseudo code to not recalculate atom properties matrices if they already saved
Diffstat (limited to 'psr/basis_transformation.m')
-rw-r--r--psr/basis_transformation.m57
1 files changed, 57 insertions, 0 deletions
diff --git a/psr/basis_transformation.m b/psr/basis_transformation.m
new file mode 100644
index 0000000..82945fe
--- /dev/null
+++ b/psr/basis_transformation.m
@@ -0,0 +1,57 @@
+1;
+
+% matrix of circular to linear transformation
+% [x, y, z]' = lin2circ * [r, l, z]'
+function transformation_matrix = circ2lin()
+ transformation_matrix = ...
+ [ ...
+ [ 1/sqrt(2), 1/sqrt(2), 0]; ...
+ [-1i/sqrt(2), 1i/sqrt(2), 0]; ...
+ [ 0, 0, 1] ...
+ ];
+endfunction
+
+
+% matrix of linear to circular transformation
+% [r, l, z]' = lin2circ * [x, y, z]'
+function transformation_matrix = lin2circ()
+ transformation_matrix = ...
+ [ ...
+ [ 1/sqrt(2), 1i/sqrt(2), 0]; ...
+ [ 1/sqrt(2), -1i/sqrt(2), 0]; ...
+ [ 0, 0, 1] ...
+ ];
+endfunction
+% linear basis rotation
+% x axis untouched
+% z and y rotated by angle theta around 'x' axis
+% [x_new, y_new, z_new]' = oldlin2newlin * [x_old, y_old, z_old]'
+function oldlin2newlin_m = oldlin2newlin(theta)
+ oldlin2newlin_m = [ ...
+ [ 1, 0, 0]; ...
+ [ 0, cos(theta), -sin(theta)]; ...
+ [ 0, sin(theta), cos(theta)]...
+ ];
+endfunction
+
+% rotate x polarized light by angle phi around
+% light propagation axis (Z)
+function [E_field_x, E_field_y] = rotXpolarization(phi, E_field_linear)
+ % important negative frequency behave as they rotate in opposite direction
+ E_field_x=cos(phi)*E_field_linear;
+ E_field_y=sin(phi)*E_field_linear;
+endfunction
+
+% transform x,y,z linearly polarized light in the lab/light system coordinate
+% to left, right, linear along z atom system of coordinate
+% atom magnetic field is along new axis Z wich is at angle theta with respect to
+% light propagation direction
+function E_field_pos_freq=xyz_lin2atomic_axis_polarization(theta, E_field_lab_pos_freq)
+ coord_transf_m = lin2circ() * oldlin2newlin(theta);
+ E_field_pos_freq.right = coord_transf_m(1,1)*E_field_lab_pos_freq.x + coord_transf_m(1,2)*E_field_lab_pos_freq.y + coord_transf_m(1,3)*E_field_lab_pos_freq.z;
+ E_field_pos_freq.left = coord_transf_m(2,1)*E_field_lab_pos_freq.x + coord_transf_m(2,2)*E_field_lab_pos_freq.y + coord_transf_m(2,3)*E_field_lab_pos_freq.z;
+ E_field_pos_freq.linear = coord_transf_m(3,1)*E_field_lab_pos_freq.x + coord_transf_m(3,2)*E_field_lab_pos_freq.y + coord_transf_m(3,3)*E_field_lab_pos_freq.z;
+endfunction
+
+
+% vim: ts=2:sw=2:fdm=indent