function []=dispim(frame, n, zdispim)
% USAGE:
%
% dispim
% dispim(opt)
% dispim(frame,n)
% dispim(frame,n,zdispim)
%
% Input Arguments:
% frame Index of the image in the array u_norm which should be displayed
% opt Flag indicator to plot the stitched images previously generated from stim() or stim2()
% 1 - Plot results from stim()
% 2 - Plot results from stim2()
% n Color bar control (spans from -n*piv_ustd to n*piv_ustd). If n < 0 then
% only the -ve values are plotted. THe color bar is still set as a factor of n.
% zdispim 2-D array containing z data or u data (must be a 2D array)
%
% Output: image plot along with the velocity vector plot (by default it plots u_norm)
%
% Examples & Remarks:
%
% dispim
% - > Results in plot of difference image of stitched images previously generated by stim() & stim2() routines.
% Make sure that stim() & stim2() routines have been executed previously otherwise it will result in a run-time error.
%
% dispim(1)
% - > Results in plot of stitched images previously generated by stim() routine.
% Make sure that stim() routine have been executed previously otherwise it will result in a run-time error.
%
% dispim(2)
% - > Results in plot of stitched images previously generated by stim2() routine.
% Make sure that stim2() routine have been executed previously otherwise it will result in a run-time error.
%
% dispim(100,3)
% - > Results in velocity vector plot of u_norm corresponding to frame 100 and color bar is set +/-3* std(u)
%
% dispim(100,-1)
% - > Results in velocity vector plot of u_norm corresponding to frame 100 but only -ve velocities are considered.
% Color bar is set +/-1* std(u)
%
% dispim(100,4,zdispim)
% - > Results in velocity vector plot of 2D array zdispim. Note zdispim must be a 2D array.
% The color bar would be set to +/-4*std(u)
%
% dispim(100,-1,zdispim)
% - > Results in velocity vector plot of 2D array zdispim but only -ve values are considered. Note zdispim must be a 2D array.
% The color bar would be set to +/-1*std(u)
%
% dispim(zdispim)
% - > Results in velocity vector plot of 2D array zdispim while zdispim is assumed to be same size as uim which would have
% generated by stim(). the purpose of this option is to plot the processed image resulting from uim which identifies the
% slow speed regions using routine strkfind(). The color bar would be set to +/-1*std(u)
%
% dispim(x,y,zdispim)
% - > Results in velocity vector plot of 2D array zdispim with size dimension x & y. The purpose of this option is to plot any
% 2D array with the it's x & y dimensions given. This is useful in the diganostics of tracking algorithms where it allows the
% plotting of images resulting from various hypothesis. The resulting plot is easier for comparison.
% The color bar would be set to +/-3*std(u)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% 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: %%
%% dispim.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 %%
%% %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global x y piv_ustd vecimfreq u_norm u v uim xim yim uim xim1 yim1 uim1 xim3 yim3 uim3 delta_99 u_tau nu
switch nargin
case 0
figure;
xim3 = xim1;
yim3 = yim1;
xlen = size(xim1,1);
uim3(1:xlen,:) = (uim(1:xlen,:) - uim1(:,:))./uim(1:xlen,:);
uim3std = mean(std(uim3));
uim3max = max(max(abs(uim3)));
pcolor(xim3/delta_99, yim3/delta_99 , abs(uim3))
caxis([0 6*piv_ustd])
colorbar
shading interp;
lighting phong;
daspect([1 1 1]);
xlabel('x^{+} ->');
ylabel('y^{+} ->');
title(['Difference Image']);
drawnow;
case 1
if(length(frame) ~= 1)
zdispim = frame;
% here I'm assuming that zdispim has the same dimensions as uim
figure;
pcolor(sort(-xim/delta_99), yim/delta_99, zdispim)
caxis([-3*piv_ustd 3*piv_ustd])
shading interp;
lighting phong;
daspect([1 1 1]);
hold on
%quiver(xim, yim, uim, vim, 1,'k')
hold off
xlabel('x/\delta ->');
ylabel('y/\delta ->');
title(['Identified structures in previously stithed image, Flow is from left to right']);
drawnow;
else
opt = frame;
switch opt
case 1
figure;
pcolor(sort(-xim/delta_99), yim/delta_99, uim)
caxis([-3*piv_ustd 3*piv_ustd])
shading interp;
lighting phong;
daspect([1 1 1]);
hold on
%quiver(xim, yim, uim, vim, 1,'k')
hold off
xlabel('x/\delta ->');
ylabel('y/\delta ->');
title(['Stitched image as produced by stim(), Flow is from left to right']);
drawnow;
case 2
figure;
pcolor(sort(-xim1/delta_99), yim1/delta_99, uim1)
caxis([-3*piv_ustd 3*piv_ustd])
shading interp;
lighting phong;
daspect([1 1 1]);
%hold on
%quiver(xim1, yim1, uim1, vim1, 1,'k')
%hold off
% xlabel('Streamwise distance normalized by \delta_{99} ->');
% ylabel('Spanwise distance, normalized by \delta_{99} ->');
xlabel('x/\delta ->');
ylabel('y/\delta ->');
title(['Stitched image as produced by stim2(), Flow is from left to right']);
drawnow;
otherwise
dispimerr
end
end % End of if block, array type determination (length(frame) ~=1)
case 2
switch n
case n*(n>0)
zdispim = squeeze(u_norm(frame,:,:));
figure;
pcolor(x*u_tau/nu, y*u_tau/nu, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
caxis([-n*piv_ustd n*piv_ustd]) % i am setting the colorbar based on the rms of the signal
title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
xlabel('x^{+}');
ylabel('y^{+}');
cb = colorbar('vert'); % display the colorbar
shading interp; % interpolated shading
lighting phong; % nice spline fit to the shading
daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
hold on;
quiver(x*u_tau/nu, y*u_tau/nu, squeeze(u_norm(frame,:,:)), squeeze(v(frame,:,:)),1.5,'k');
hold off;
case n*(n<0)
figure;
zdispim = squeeze(u_norm(frame,:,:));
zdispim = zdispim.*(zdispim < 0);
pcolor(x*u_tau/nu, y*u_tau/nu, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
caxis([-abs(n)*piv_ustd abs(n)*piv_ustd]) % i am setting the colorbar based on the rms of the signal
cb = colorbar('vert'); % display the colorbar
shading interp; % interpolated shading
lighting phong; % nice spline fit to the shading
title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
xlabel('x^{+}');
ylabel('y^{+}');
daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
otherwise
dispimerr;
end
case [3]
if(length(n) ~= 1)
xdispim = frame;
ydispim = n;
% here I'm assuming that zdispim has the same dimensions as uim
figure;
pcolor(sort(-xdispim/delta_99), ydispim/delta_99, zdispim)
caxis([-3*piv_ustd 3*piv_ustd])
shading interp;
lighting phong;
daspect([1 1 1]);
hold on
%quiver(xim, yim, uim, vim, 1,'k')
hold off
xlabel('x/\delta ->');
ylabel('y/\delta ->');
title(['Identified structures in previously stithed image, Flow is from left to right']);
drawnow;
else
switch n
case n*(n>0)
figure;
pcolor(x*u_tau/nu, y*u_tau/nu, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
caxis([-abs(n)*piv_ustd abs(n)*piv_ustd]) % i am setting the colorbar based on the rms of the signal
cb = colorbar('vert'); % display the colorbar
shading interp; % interpolated shading
lighting phong; % nice spline fit to the shading
title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
xlabel('x^{+}');
ylabel('y^{+}');
daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
case n*(n<0)
figure;
zdispim = zdispim.*(zdispim < 0);
pcolor(x*u_tau/nu, y*u_tau/nu, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
caxis([-abs(n)*piv_ustd abs(n)*piv_ustd]) % i am setting the colorbar based on the rms of the signal
cb = colorbar('vert'); % display the colorbar
shading interp; % interpolated shading
lighting phong; % nice spline fit to the shading
title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
xlabel('x^{+}');
ylabel('y^{+}');
daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
otherwise
dispimerr;
end
end
otherwise
dispimerr;
end
function []=dispimerr()
disp (' ERROR: Wrong type/number of arguments.');
help dispim;
%if(nargin < 2)
% dispimerr;
%
%elseif(nargin == 3 && n<0)
%
% figure;
%
% switch n
% case -1
% zdispim = zdispim.*(zdispim < 0);
% pcolor(x, y, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
% otherwise
% end
%
% caxis([-3*piv_ustd 3*piv_ustd]) % i am setting the colorbar based on the rms of the signal
% cb = colorbar('vert'); % display the colorbar
% shading interp; % interpolated shading
% lighting phong; % nice spline fit to the shading
%
% title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
% xlabel('x (m)');
% ylabel('y (m)');
% daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
%
%else
%
% zdispim = squeeze(u_norm(frame,:,:));
% zdispim = zdispim.*(zdispim < 0);
%
% figure;
%
% pcolor(x, y, zdispim); % the squeeze is to squeeze down a 3d matrix (where one of the dimensions is one) to a 2d matrix
% caxis([-n*piv_ustd n*piv_ustd]) % i am setting the colorbar based on the rms of the signal
%
%
% cb = colorbar('vert'); % display the colorbar
% shading interp; % interpolated shading
% lighting phong; % nice spline fit to the shading
%
% title(['Image frame # ',num2str(frame),'at time ', num2str(frame/vecimfreq, '%.5f'), ' s'])
% xlabel('x (m)');
% ylabel('y (m)');
% daspect([1 1 1]); % set aspect ratio to one (equal x and y scale)
%
% hold on;
% quiver(x, y, squeeze(u_norm(frame,:,:)), squeeze(v(frame,:,:)), 1.5);
% hold off;
%end
%
%
%
%
%
%
%function []=dispimerr()
% disp (' ERROR: Insufficient arguments.');
% help dispim;
%
%