function [freq,vg,vph,nm_vs_f]=disp_curv(hdf_root,mode_nos,freqs,iisym,iilog,ii1pl)
% Call [freq,vg,vph,nm_vs_f]=disp_curv('hdf_root',mode_nos,freqs,iisym,iilog,ii1pl);
% Set mode_nos=[] for all modes. 
% freqs=[fmin,fmax] to be plotted (set to [] for all frequencies).
% iisym: 0=line only, 1=symbol & line, 2=symbol only.
% iilog=1 for logarithmic velocity axes.
% ii1pl=1 for both on same plot.
% nm_vs_f is returned as the number of modes at each frequency.
format compact
[setno,setnames]=scanhdf([hdf_root,'_hdf']),
%
% Read in group velocities vg (first to figure out how many frequencies):
jf=hdf_find(setnames,'_vg'),
string=['[freq,mode_ax,vg,dataname]=selecthdf(''',hdf_root,'_hdf',''',jf);'],
eval(string)
jf=hdf_find(setnames,'_vph'),
string=['[freq,mode_ax,vph,dataname]=selecthdf(''',hdf_root,'_hdf',''',jf);'],
eval(string)
[nfreq,nmode]=size(vg);
colors=['y','m','c','r','g','b'];
if isempty(mode_nos), mode_nos=[1:nmode]; end
if isempty(freqs), 
   iifr=[1:nfreq]; 
else
   iifr=find(freq >= freqs(1) & freq <= freqs(2));
end
freq2=freq(iifr);
vg2=vg(iifr,mode_nos);
vph2=vph(iifr,mode_nos);
nmdo=length(mode_nos);
nm_vs_f=sum(vg'>0);
figure
if ii1pl==1, subplot(2,1,1), end

for jj=1:nmdo
   j=mode_nos(jj); 
   ii=find(vg2(:,jj)>0); 
   if length(ii)>0,
      col=colors(rem(jj,6)+1);
	  if iilog==1,
         if iisym == 0,
		    semilogy(freq2(ii),vg2(ii,jj),col);
		 elseif iisym ==1,
		    semilogy(freq2(ii),vg2(ii,jj),col,freq2(ii),vg2(ii,jj),['*',col]);
		 else
            semilogy(freq2(ii),vg2(ii,jj),['*',col]);
		 end
	  else
         if iisym == 0,
		    plot(freq2(ii),vg2(ii,jj),col);
		 elseif iisym ==1,
		    plot(freq2(ii),vg2(ii,jj),col,freq2(ii),vg2(ii,jj),['*',col]);
		 else
            plot(freq2(ii),vg2(ii,jj),['*',col]);
		 end
	  end
      text(freq2(ii(1)),vg2(ii(1),jj),int2str(mode_nos(jj)));
   end
   hold on
end
hold off
grid
xlabel('Frequency  Ð Hz'); ylabel('Group Velocity  Ð m/s');
mytitle(hdf_root)
%
if ii1pl==1, subplot(2,1,2), else, figure, end

for jj=1:nmdo
   j=mode_nos(jj); 
   ii=find(vg2(:,jj)>0); 
   if length(ii)>0,
      col=colors(rem(jj,6)+1);
	  if iilog==1,
	     if iisym == 0,
		    semilogy(freq2(ii),vph2(ii,jj),col)
         elseif iisym == 1,
            semilogy(freq2(ii),vph2(ii,jj),col,freq2(ii),vph2(ii,jj),['*',col]);
         else	  
            semilogy(freq2(ii),vph2(ii,jj),['*',col]);
         end
	  else
	     if iisym == 0,
		    plot(freq2(ii),vph2(ii,jj),col)
         elseif iisym == 1,
            plot(freq2(ii),vph2(ii,jj),col,freq2(ii),vph2(ii,jj),['*',col]);
         else	  
            plot(freq2(ii),vph2(ii,jj),['*',col]);
         end
	  end
      text(freq2(ii(1)),vph2(ii(1),jj),int2str(j));
   end
   hold on
end
hold off
grid
xlabel('Frequency  Ð Hz'); ylabel('Phase Velocity  Ð m/s');
if ii1pl==0, mytitle(hdf_root), end
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
