summaryrefslogtreecommitdiff
path: root/useful_functions.m
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2009-12-09 19:47:57 +0000
committerEugeniy Mikhailov <evgmik@gmail.com>2009-12-09 19:47:57 +0000
commitd0071faa593907567ffafc0fedf63f209ab1293f (patch)
tree67a8dd108a5bfe8464304c0698ea204aa225095b /useful_functions.m
parent13d34ca7ec36b7d6ab937a8333d5cea7dc3aa69c (diff)
downloadmulti_mode_eit-d0071faa593907567ffafc0fedf63f209ab1293f.tar.gz
multi_mode_eit-d0071faa593907567ffafc0fedf63f209ab1293f.zip
moved some useful functions to separate file
Diffstat (limited to 'useful_functions.m')
-rw-r--r--useful_functions.m30
1 files changed, 30 insertions, 0 deletions
diff --git a/useful_functions.m b/useful_functions.m
new file mode 100644
index 0000000..748a677
--- /dev/null
+++ b/useful_functions.m
@@ -0,0 +1,30 @@
+1;
+
+% calculate total decay for particular level taking in account all branches
+function ret=decay_total(g_decay,i)
+ ret=0;
+ for k=1:size(g_decay)(1)
+ ret=ret+g_decay(i,k);
+ endfor
+endfunction
+
+% kroneker delta symbol
+function ret=kron_delta(i,j)
+ if ((i==j))
+ ret=1;
+ else
+ ret=0;
+ endif
+endfunction
+
+% this function create from Liouville density vector
+% the density matrix with given modulation frequency
+function rho=rhoOfFreq(rhoLiouville, freqIndex, Nlevels, Nfreq)
+ rho=zeros(Nlevels);
+ for r=1:Nlevels
+ for c=1:Nlevels
+ rho(r,c)=rhoLiouville((freqIndex-1)*Nlevels^2+(r-1)*Nlevels+c);
+ endfor
+ endfor
+endfunction
+