from High Speed PIV and Hotwire post processing by Anurag
High Speed PIV and hotwire post processing routines

tsa.m
k = 3;
npoints = 1000;
nstep   = n_dat/npoints;

time = 0:120/npoints:120;
u_time   = zeros(npoints);
uu_time  = zeros(npoints);
jmax = 1;
jmin = 1;
for j=1:nstep
      u(j) = polyval(e_fit,u_dat(k,j,1));
end
u_time(1)   = mean(u(1:nstep));   % Mean velocity, m/s
uu_time(1)  = std(u(1:nstep));   % Standard Deviation in velocity, m/s

for i=2:npoints
   jmin = nstep*(i-1) + 1;
   jmax = nstep*i;
   for j=jmin:jmax
      u(j) = polyval(e_fit,u_dat(k,j,1));
   end
   u_time(i)  = ((i-1)*u_time(i-1) + mean(u(jmin:jmax)))/i;
   uu_time(i)  = sqrt(((i-1)*uu_time(i-1)^2 + std(u(jmin:jmax))^2)/i);
end

figure;
plot(time(1:npoints),uu_time(1:npoints),'+b-') ;
title('Time Series plot of Turbulence Intensities at z^{+} = 20.2886')
ylabel('Turbulence Intensity, m/s')
xlabel('Time, s')

figure;
plot(time(1:npoints),u_time(1:npoints),'+b-') ;
title('Time Series plot of Mean Velocity at z^{+} = 20.2886')
ylabel('Mean Velocity, m/s')
xlabel('Time, s')

Contact us at files@mathworks.com