function dfield( xh, yh, z )

% dfield( x, y, z )
% plots pseudocolor plot of dipole field with vectors superimposed

%    Bradley A. Moran 03/29/96
%    Copyright (C) 1996, Massachusetts Institute of Technology
%    Sea Grant Underwater Vehicles Laboratory
%    $Revision: 1.1 $    $Date: 1996/03/30 23:05:17 $

if nargin < 3, z = 0; end

B = dipolex( xh, yh, z );
colormap(jet);
h = pcolor( xh, yh, B );
if any(exist( 'colorbar' ) == [2 5]), colorbar; end
set( h, 'edgecolor', 'none' );
set( gca, 'aspectratio', [1 1] );
figure(gcf);

xl = min(xh):max(xh);
yl = min(yh):max(yh);

[Bx,By]=dipolex( xl, yl, z );
B = sqrt( Bx.^2 + By.^2 );

hold on;
quiver( xl, yl, Bx./B, By./B, 'black' );
hold off;

title( sprintf('Dipole Field at z = %.1f', z) );
xlabel( 'axial distance (m)' );
ylabel( 'transverse distance (m)' );

return