%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PURPOSE: Plot range and computed altitude.
% AUTHOR:  rsm, following MIT code.
% DATE:    00/1/5
% MODS:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
global run_name;

set( gcf, 'name', 'DorOdyssey Altimeter' );

%mask = find( alt_m > 0 & alt_m < 99 );
%if exist( 'medfilt1' ) == 2 & ~isempty(mask)
%    alt_c = medfilt1( alt_m(mask), 5 );
%else
%    alt_c = alt_m(mask);
%end


winpos( position(1,:) );

subplot( 2, 1, 1 )

time = dataNav(:,1);
plot( time, dataNav(:,mDepth), 'm', ...
      time, dataNav(:,mDepth) + dataNav(:,mAltitude), 'b' );
area( time, dataNav(:,mDepth) + dataNav(:,mAltitude), ...
      'facecolor', [0 .75 .5] );
set( gca, 'YDir', 'reverse' );
line( time, dataNav(:,mDepth), 'color', [1 0.5 0], 'linewidth', 3 );
title( ['Measured Depth and Calculated Bottom: ' run_name] );
ylabel( 'Depth, Meters' );
zoom on
grid on

subplot( 2, 1, 2 )
plot( time, dataNav(:,mPsaRange), 'linewidth',2 );
title( 'Raw PSA Range' );
xlabel( 'Elapsed Time, Sec.' );
ylabel( 'Range, Meters' );
zoom on
grid on