#!/usr/bin/env python # coding: utf-8 # In[1]: # copy of poduv.m # In[ ]: # read data and rearrange in columns [r,c,N] = size(u); # 4-D is the number of files len = r*c; U = zeros(len*2,N); # r*c*3 length of the vector get_ipython().run_line_magic('', 'small rearrangement') for i = 1:N U(1:len,i) = reshape(handles.u(:,:,i),len,1); U(len+1:2*len,i) = reshape(handles.v(:,:,i),len,1); end get_ipython().run_line_magic('', 'Ensemble average of U:') get_ipython().run_line_magic('', ' meanU = mean(U,2);') get_ipython().run_line_magic('', ' Uf = U;') get_ipython().run_line_magic('', 'meanU = zeros(len,1);') get_ipython().run_line_magic('', 'Fluctuations') get_ipython().run_line_magic('', ' % Uf = U - repmat(meanU,1,N);') get_ipython().run_line_magic('', ' for i = 1:N') get_ipython().run_line_magic('', ' Uf(:,i) = U(:,i) - meanU;') get_ipython().run_line_magic('', ' end') Uf = bsxfun(@minus,U,mean(U,2));