function depthplot( time, c_dpth, t_dpth, m_dpth, 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:08:15 $
%----------------------------------------------------------------------

global run_name

rows = 1:length(time);
if diff(c_dpth(1:2)) > .5
    rows(1) = [];
end

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

cla
[xx,yy] = stairs( time(rows), c_dpth(rows) );
plot( time(rows), m_dpth(rows), xx, yy );
if ~isempty(t_dpth)
    [xx,yy] = stairs( time(rows), t_dpth(rows) );
    line( xx, yy, 'Color', [0 .7 0] );
end
set( gca, 'ydir', 'reverse' );
title( ['Commanded and Measured Depth: ' run_name] );
xlabel( 'elapsed time (s)' );
ylabel( 'depth (m)' );
grid on
zoom on
