function depthplot( time, c_depth, m_depth, c_elev, m_elev, pos )
%DEPTHPLOT      Plot depths and elevator activity.
%   DEPTHPLOT(time, c_depth, m_depth, c_elev, m_elev, pos ) plots the
%   commanded and measured depths in the top window and the commanded
%   and measured elevator angles in the bottom window.  POS is an
%   optional string argument specifying the position of the window on
%   the screen.
%
%   See also WINPOS.

%----------------------------------------------------------------------
%			  Copyright (C) 1995
%		Massachussetts Institute of Technology
%	       Sea Grant Underwater Vehicles Laboratory
%----------------------------------------------------------------------
%     $Revision: 1.1 $			$State: Exp $
%     $Author: rob $		$Date: 2000/01/10 19:07:50 $
%----------------------------------------------------------------------

global run_name;

if ( nargin < 4 ), error('too few arguments'); end
if ( nargin > 5 ), winpos( pos ); end

clf;
set( gcf, 'name', 'Depth Plots' );

subplot( 2, 1, 1 )
[xx,yy] = stairs( time, c_depth );
plot( time, m_depth, 'm', xx, yy, 'c' );
set( gca, 'xgrid', 'on', 'ydir', 'reverse', 'ygrid', 'on', 'fontsize', 10 );
title( ['Commanded and Measured Depth: ' run_name] );
xlabel( 'mission time (s)' );
ylabel( 'depth (m)' );
zoom on

subplot( 2, 1, 2 )
[xx, yy] = stairs( time, c_elev );
plot( xx, yy, 'c', time, m_elev, 'm' );
set( gca, 'xgrid', 'on', 'ylim', [-40 40], 'ygrid', 'on', 'fontsize', 10 );
title( 'Commanded and Measured Elevator Angle' );
xlabel( 'mission time (s)' );
ylabel( 'dive angle (deg)' );
zoom on

return;