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

[]=hwplots(opt,createplots)
function []=hwplots(opt,createplots)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                                                  %%
%%   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:                                                                                      %%
%%      hwplots.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                                                                                %%
%%                                                                                                  %%
%%                                                                                                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% USAGE:
%
%  hwplots(opt,createplots)
%
%  Input Arguments:
%     opt            Flag to indicate whether plots are for PIV or hotwire, legal values 'hw' or 'piv'
%     createplots    Integer array to indicate what plots to create,
%                    Legal values are between [1-3] and the values results in following plots
%
%                        1 - Calibration fit plot (not valid if opt='piv')
%                        2 - BLP
%                        3 - Turbulence Intensities
%
%  Output: Requested plots in separate windows
%
%  REMARK:
%     PIV plots differ from the HW plot only in the sense that PIV condition is marked on these plots for easy comparison.
%
%  EXAMPLE:
%
%    hwplots('piv',[1 3])
%
%     This would result in calibration fit & turbulence intensity plot with PIV experimental conditions marked on them.
% generate plots


global hw_u_cal hw_e_cal hw_u_fit
global hw_num_pos hw_z_plus hw_u_plus hw_u_plus_calc
global hw_u_inf hw_ustd piv_zplus piv_ustd piv_ubarplus

if(nargin ~= 2)
   disp ('  ERROR: Insufficient arguments.');
   help hwplots;
else

   if(strcmp(opt,'hw'))
      for m=1:size(createplots,2)
         switch createplots(m)
            case 1
               % plot the calibration curve to show the fit
               figure;
               plot(hw_u_cal,hw_e_cal,'*r');
               hold on;
               plot(hw_u_fit,hw_e_cal,'-b');
               hold off;
               grid on;
               title(['Calibration Curve for Hotwire; U_{\infty}=',num2str(hw_u_inf,3),' m/s']);
               xlabel('Velocity u m/s')
               ylabel('Voltage, V');
               legend(['Experiment';'Fit       ']);

            case 2
               figure;
               semilogx(hw_z_plus(1:hw_num_pos),hw_u_plus(1:hw_num_pos),'*r');
               hold on;
               semilogx(hw_z_plus(1:hw_num_pos),hw_u_plus_calc(1:hw_num_pos),'-b');
               h=line([50,50],[0,hw_u_plus(hw_num_pos)*1.2]);   set(h,'Color','b');
               h=line([200,200],[0,hw_u_plus(hw_num_pos)*1.2]); set(h,'Color','b');
               title(['Boundary Layer Velocity Profile at U_{inf}=',num2str(hw_u_inf,3),' m/s and Law of the Wall'])
               xlabel('Non-dimensional Wall Normal Location, z^{+}')
               ylabel('Mean Velocity, U^{+}')
               hold off;
               grid on;

            case 3
               figure;
               semilogx(hw_z_plus,hw_ustd,'*b');
               hold on;
               h=line([50,50],[0,hw_ustd(1)*1.2]);   set(h,'Color','r');
               h=line([200,200],[0,hw_ustd(1)*1.2]); set(h,'Color','r');
               %h=line([101,101],[0,hw_ustd(1)*1.2]); set(h,'Color','r');
               %h=line([50,50],[0,hw_ustd(1)*1.2]); set(h,'Color','r');
               
               title(['Turbulence Intensities at U_{\infty}=',num2str(hw_u_inf,3),' m/s']);
               xlabel('Non-dimensional Wall Normal Location, z^+')
               ylabel('Turbulence Intensity, u'' m/s');
               grid on;

             otherwise
               disp(['ERROR: Unknown plot request ',num2str(createplots(m))]);
         end
      end

   elseif(strcmp(opt,'piv'))

      for m=1:size(createplots,2)
         switch createplots(m)
            case 2
               figure;
               semilogx(hw_z_plus(1:hw_num_pos),hw_u_plus(1:hw_num_pos),'*r');
               hold on;
               semilogx(47,14.39,'s','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',10);
               semilogx(101,16.12,'s','MarkerEdgeColor','k','MarkerFaceColor','b','MarkerSize',10);
               legend(['HW             '; 'PIV z^{+} = 47 '; 'PIV z^{+} = 101']);
               %semilogx(hw_z_plus(1:hw_num_pos),hw_u_plus_calc(1:hw_num_pos),'-b');
               %line([50,50],[0,hw_u_plus(hw_num_pos)*1.2])
               %line([200,200],[0,hw_u_plus(hw_num_pos)*1.2])

               %h=line([piv_zplus,piv_zplus],[0,hw_u_plus(hw_num_pos)*1.2]);     set(h,'Color','g');
               %h=line([10,1000],[piv_ubarplus,piv_ubarplus]);                   set(h,'Color','g');

               %title(['Boundary Layer Velocity Profile at U_{inf}=',num2str(hw_u_inf,3)])
               xlabel('Non-dimensional Wall Normal Location, z^{+}')
               ylabel('Mean Velocity, U^{+}')
               hold off;
               grid on;

            case 3
               figure;
               semilogx(hw_z_plus,hw_ustd,'*b');
               hold on;
               semilogx(47,0.53,'s','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',10);
               semilogx(101,0.43,'s','MarkerEdgeColor','k','MarkerFaceColor','b','MarkerSize',10);
               legend(['HW             '; 'PIV z^{+} = 47 '; 'PIV z^{+} = 101']);
               %line([50,50],[0,hw_ustd(1)*1.2])
               %line([200,200],[0,hw_ustd(1)*1.2])
               %h=line([piv_zplus,piv_zplus],[0,hw_ustd(1)*1.2]);   set(h,'Color','g');
               %h=line([10,1000],[piv_ustd,piv_ustd]);              set(h,'Color','g');
               title(['Turbulence Intensities at U_{inf}=',num2str(hw_u_inf,3),' m/s']);
               xlabel('Non-dimensional Wall Normal Location, z^+')
               ylabel('Turbulence Intensity, u'' m/s');
               grid on;

             otherwise
               disp(['ERROR: Unknown plot request ',num2str(createplots(m))]);
         end
      end

   else
      disp(['ERROR: Unknown option request ''',opt,'''']);
   end
end

Contact us at files@mathworks.com