diff options
Diffstat (limited to 'useful_functions.m')
-rw-r--r-- | useful_functions.m | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/useful_functions.m b/useful_functions.m index 10afb69..8e73ddf 100644 --- a/useful_functions.m +++ b/useful_functions.m @@ -26,22 +26,20 @@ function [N, rhoLiouville_w, rhoLiouville_r, rhoLiouville_c]=unfold_density_matr % unwrap density matrix to Liouville density vector and assign all possible % modulation frequencies as well % resulting vector should be Nlevels x Nlevels x length(modulation_freq) - N=Nfreq*Nlevels*Nlevels; + N = Nfreq*Nlevels*Nlevels; + rho_size = Nlevels*Nlevels; rhoLiouville_w=zeros(N,1); rhoLiouville_r=zeros(N,1); rhoLiouville_c=zeros(N,1); - i=0; - for w=1:Nfreq; - for r=1:Nlevels - for c=1:Nlevels - i+=1; - rhoLiouville(i)=0; - rhoLiouville_w(i)=w; % hold frequency modulation index - rhoLiouville_r(i)=r; % hold row value of rho_rc - rhoLiouville_c(i)=c; % hold column value of rho_rc - endfor - endfor - endfor + + w=1:Nfreq; + w_tmplate(:)=repmat(w,rho_size,1); + rhoLiouville_w=w_tmplate'; + r=1:Nlevels; + r_tmplate(:)=repmat(r,Nlevels,1); + rhoLiouville_r(:)=repmat(r_tmplate',Nfreq,1); + c=(1:Nlevels)';% hold column value of rho_rc + rhoLiouville_c=repmat(c,Nfreq*Nlevels,1); endfunction |