%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Plot DVL data.
% AUTHOR:  Rob McEwen
% DATE:    01/3/15
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

  if exist('dataDvl') ~= 1, return, end

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


  if exist( 'dvlFig' ) ~= 1
    dvlFig = figure;
    winpos( position(1,:) );
  else
    figure(dvlFig);
  end
  set( dvlFig, 'Name', 'DVL Plot', 'DeleteFcn', 'clear dvlFig' );

  nstrips = 6;

  subplot(nstrips,1,1)
  [xx,yyB]  = stairs( dataDvl(:,1), dataDvl(:,dvlBotVelx) );
  [xx,yyW]  = stairs( dataDvl(:,1), dataDvl(:,dvlWatVelx) );
  plot(xx, [yyB yyW ] );
  ylabel('Body X')
  title(['Dvl Measurement ',str]);
  grid on
  zoom on
  
  subplot(nstrips,1,2)
  [xx,yyB]  = stairs( dataDvl(:,1), dataDvl(:,dvlBotVely) );
  [xx,yyW]  = stairs( dataDvl(:,1), dataDvl(:,dvlWatVely) );
  plot(xx, [yyB yyW ] );
  ylabel('Body Y')
  grid on;
  zoom on;
  
  subplot(nstrips,1,3)
  [xx,yyB]  = stairs( dataDvl(:,1), dataDvl(:,dvlBotVelz) );
  [xx,yyW]  = stairs( dataDvl(:,1), dataDvl(:,dvlWatVelz) );
  plot(xx, [yyB yyW ] );
  ylabel('Body Z')
  grid on;
  zoom on;

  BotVelMag = sqrt( dataDvl(:,dvlBotVelx).^2 + ...
		    dataDvl(:,dvlBotVely).^2 + ...
		    dataDvl(:,dvlBotVelz).^2 );

  WatVelMag = sqrt( dataDvl(:,dvlWatVelx).^2 + ...
		    dataDvl(:,dvlWatVely).^2 + ...
		    dataDvl(:,dvlWatVelz).^2 );

  subplot(nstrips,1,4)
  [xx,yyB]  = stairs( dataDvl(:,1), BotVelMag );
  [xx,yyW]  = stairs( dataDvl(:,1), WatVelMag );
  plot(xx, [yyB yyW ] );
  ylabel('|Vel|')
  grid on;
  zoom on;

  subplot(nstrips,1,5)
  plot(dataDvl(:,1), [ dataDvl(:,dvlBotVelStat) dataDvl(:,dvlWatVelStat) ]);
  ylabel('Bot & Wat Stat')
  grid on;
  zoom on;

  subplot(nstrips,1,6)
  [xx,yy]  = stairs( dataDvl(:,1), dataDvl(:,dvlTemp) );
  plot(xx, yy );
  ylabel('Centigrade')
  xlabel('Elapsed Time (s)');
  grid on;
  zoom on;

  return




