1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
1;
% matrix of circular to linear transformation
% [x, y, z]' = lin2circ * [r, l, z]'
circ2lin= [ ...
[ 1/sqrt(2), 1/sqrt(2), 0]; ...
[-1i/sqrt(2), 1i/sqrt(2), 0]; ...
[ 0, 0, 1] ...
];
% matrix of linear to circular transformation
% [r, l, z]' = lin2circ * [x, y, z]'
lin2circ= [
[ 1/sqrt(2), 1i/sqrt(2), 0]; ...
[ 1/sqrt(2), -1i/sqrt(2), 0]; ...
[ 0, 0, 1] ...
];
% 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, modulation_freq)
% important negative frequency behave as they rotate in opposite direction
E_field_x=cos(phi*sign(modulation_freq)).*E_field_linear;
E_field_y=sin(phi*sign(modulation_freq)).*E_field_linear;
endfunction
% vim: ts=2:sw=2:fdm=indent
|