%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Plot Altex/QNX navigation data.
% AUTHOR:  Initial; rsm
% DATE:    99/12/14
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Units and Fundamental Constants:
  units

  global run_name;

  if exist( 'jitterFig' ) ~= 1
    jitterFig = figure;
    position = [3 32 719 917];
    winpos(position(1,:));
  else 
    jitterFig = figure( jitterFig );
  end

  set( jitterFig, 'name', 'DorOdyssey Jitter', 'DeleteFcn', 'clear jitterFig' );


  subplot( 4, 1, 1 )
  cla
    time = dataDC(:,1);
    m = size( time, 1 );
    m1= size( dataNav(:,1), 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    [xx1,yy1] = stairs( dataNav(1:m1-1), diff(dataNav(:,1)) );
    plot( xx, yy*1000, xx1, yy1*1000 );
    title( ['Backdifference of Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    legend('Control','Navigation',0)
    grid on 
    zoom on

  subplot( 4, 1, 2 )
  cla
    time  = kvhCompass(:,1);
    time1 = kvhInclin(:,1);
    m = size( time, 1 );
    m1= size( time1, 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    [xx1,yy1] = stairs( time1(1:m1-1), diff(time1(:,1)) );
    plot( xx, yy*1000, xx1, yy1*1000 );
    title( ['Backdifference of Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    legend('Compass','Inclo',0)
    grid on 
    zoom on

  subplot( 4, 1, 3 )
  cla
    time = ctdlog(:,1);
    m = size( time, 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    plot( xx, yy*1000);
    title( ['Backdifference of CTD Log Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    zoom on
    grid on
 
  subplot( 4, 1, 4 )
  cla
    time = parosci(:,1);
    m = size( time, 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    plot( xx, yy*1000);
    title( ['Backdifference of ParoSci Log Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    zoom on
    grid on
 
if 0

  subplot( 6, 1, 5 )
  cla
    time = psa916log(:,1);
    m = size( time, 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    plot( xx, yy*1000);
    title( ['Backdifference of ParoSci Log Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    zoom on
    grid on
 
  subplot( 6, 1, 6 )
  cla
    time = gps(:,1);
    m = size( time, 1 );
    [xx,yy] = stairs( time(1:m-1), diff(time) );
    plot( xx, yy*1000);
    title( ['Backdifference of ParoSci Log Time-Stamps: ' run_name] );
    ylabel( 'Duration, milli-Sec.' );
    xlabel( 'Elapsed Time Sec.' );
    zoom on
    grid on

end