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

histo.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                                                  %%
%%   Copyright (C) 2005-2007  Anurag Singh                                                          %%
%%                                                                                                  %%
%%       This program/code snippet/file (hence forth refered as "library")                          %%
%%       is free software; you can redistribute it and/or                                           %%
%%       modify it under the terms of the GNU Lesser General Public                                 %%
%%       License as published by the Free Software Foundation; either                               %%
%%       version 2.1 of the License, or (at your option) any later version.                         %%
%%                                                                                                  %%
%%       This library is distributed in the hope that it will be useful,                            %%
%%       but WITHOUT ANY WARRANTY; without even the implied warranty of                             %%
%%       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                          %%
%%       Lesser General Public License for more details.                                            %%
%%                                                                                                  %%
%%       You should have received a copy of the GNU Lesser General Public                           %%
%%       License along with this library; if not, write to the Free Software                        %%
%%       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                  %%
%%                                                                                                  %%
%%   FILENAME:                                                                                      %%
%%      histo.m                                                                                     %%
%%                                                                                                  %%
%%   AUTHOR:                                                                                        %%
%%                                                                                                  %%
%%      Anurag Singh,                                                                               %%
%%      MS, 2007                                                                                    %%
%%      Aerospace Engineering & Mechanics                                                           %%
%%      University of Minnesota - Twin Cities.                                                      %%
%%      Minneapolis, MN 55455 (USA)                                                                 %%
%%                                                                                                  %%
%%      (currently working at: Exa Corporation, Burlington, MA 01803)                               %%
%%                                                                                                  %%
%%   CONTACT/EMAIL:                                                                                 %%
%%                                                                                                  %%
%%      anurag@aem.umn.edu                                                                          %%
%%      anurag9@gmail.com                                                                           %%
%%                                                                                                  %%
%%   SOURCE CONTROL INFORMATION:                                                                    %%
%%      None (since I was planning on putting it under source control since it has                  %%
%%      reached the critical file system size. Would be a good thing to put it under                %%
%%      source control while making changes.                                                        %%
%%                                                                                                  %%
%%   DESCRIPTION:                                                                                   %%
%%                                                                                                  %%
%%       Need to add                                                                                %%
%%                                                                                                  %%
%%                                                                                                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



% histogram movie
makehistmov = 0;

figure;
[n,xout] = hist(reshape(uim,[1 size(uim,1)*size(uim,2)]),300);
bar(xout, n);
title(['PDF distribution of the stream wise velocity (total ',num2str(200),' frames, no image skipping)'])
ylabel('Count #')
xlabel('Streamwise Velocity')

figure;
[n1,xout]  = hist(reshape(uim1,[1 size(uim1,1)*size(uim1,2)]),100);
bar(xout, n1);
hold on;
title(['PDF distribution of the stream wise velocity (total ',num2str(200),' frames, image skipping)'])
ylabel('Count #')
xlabel('Streamwise Velocity')


if(makehistmov == 1)
   mov = avifile('histo.avi', 'FPS', 1, 'Compression', 'none') % no compression, 5 frames per second


   for frame = 1:10
      hist(u(frame,:,:),100);
      F   = getframe(gca);
      mov = addframe(mov,F);
      clf
   end

   mov = close(mov);
end



% Histogram at a particular spanwise location
spany = 30;

imsiz = size(u,2);
uhw = zeros(1,size(u,1)*size(u,2));

for i=1:size(u,1)
   uhw(((i-1)*imsiz + 1):(i*imsiz)) = u_norm(i,:,spany);
end


figure;
[n1,xout]  = hist(uhw,800);
bar(xout, n1);
hold on;
title(['PDF distribution of the stream wise velocity (total ',num2str(size(u,1)),' frames)'])
ylabel('Count #')
xlabel('Streamwise Velocity')


Contact us at files@mathworks.com