%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Plot dvl data
% AUTHOR:  rsm
% DATE:    00/10/24
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

 titleStr = ['; Data Set: ', DirName];
 
 if exist('dvlData') ~= 1, 
    disp(' dvlData is not present.')
    return, 
  end

  str = [' ',titleStr,' Plotted on ',myDate];
  PaperPosn = [.5 .5 3.75 2.5];
  FigurePosn = [5 30 815 760];
  i = 0;
  

  if exist( 'dvlfig1' ) ~= 1
    dvlfig1 = figure;
    set(gcf,'position',FigurePosn)
  else
    figure(dvlfig1);
  end
  set( dvlfig1, 'Name', 'DVL: Velocity', 'DeleteFcn', 'clear dvlfig1' );
  
  
  subplot(3,1,1)
  plot(dvlData(:,1), dvlData(:,3:5))
  legend('X','Y','Z')
  ylabel('Meters/Sec')
  title('Velocity in Instrument Coords')
  grid on 
  zoom on

  subplot(3,1,2)
  plot(dvlData(:,1), sqrt(dvlData(:,3:5).*dvlData(:,3:5)*[1 1 1]'))
  grid on 
  zoom on
  title('Speed')

  subplot(3,1,3)
  plot(dvlData(:,1), dvlData(:,9:10))
  grid on 
  zoom on
  set(gca,'YLim',[-.1 1.1])
  legend('comsValid','dvlValid')
  title('Data Valid Flags')
  xlabel('Ticks')
  
  
  if exist( 'dvlfig2' ) ~= 1
    dvlfig2 = figure;
    set(gcf,'position',FigurePosn)
  else
    figure(dvlfig2);
  end
  set( dvlfig2, 'Name', 'DVL: Altitude', 'DeleteFcn', 'clear dvlfig2' );
  
  
  subplot(3,1,1)
  plot(dvlData(:,1), dvlData(:,6))
  ylabel('Meters')
  title('Altitude')
  grid on 
  zoom on

  subplot(3,1,2)
  plot(dvlData(:,1), dvlData(:,7))
  grid on 
  zoom on
  ylabel('Centigrade')
  title('Temperature')

  subplot(3,1,3)
  plot(dvlData(:,1), dvlData(:,8))
  grid on 
  zoom on
  ylabel('Meters/Sec')
  title('Speed of Sound')
