summaryrefslogtreecommitdiff
path: root/useful_functions.m
blob: 748a6771c1f36cb54de46f35d328321c6491b6b2 (plain)
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
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