Documentation of pncontm


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

[hh, cc] = pncontm(xa, ya, x, clev, lab, s);

Help text

     pncont(xa, ya, x, clev, lab);

     This function will plot positive contours of x in solid
     lines, and negative contours of x in dashed lines.

     pncont(x) pncont's the matrix 'x'.
     pncont(xa, ya, x) uses xa and ya as the x and y axes resp.
     pncont(xa, ya, x, clev) uses levels outlined in 'clev', or if
                             clev is an integer, uses clev levels.
     pncont(xa, ya, x, clev, lab) lab = 0 => don't label contours (default)
                                  lab = 1 => label contours


Cross-Reference Information

This function is called by

Listing of function pncontm

function [hh, cc] = pncontm(xa, ya, x, clev, lab, s);
lw = 1;
if nargin == 5;
  if isstr(s);
    lab = 0;
  else
    lab = s; s = [];
  end
end
if nargin < 5; lab = 0; s = []; end;
if nargin < 4; clev = 10; end;
if nargin == 1;
  x = xa;
  [m, n] = size(x);
  xa = 1:n;
  ya = 1:m;
end;

[m,n] = size(x);

for i = 1:m;
  for j = 1:n;
    if x(i,j) <= 0;
      xp(i,j) = 0;
      xn(i,j) = x(i,j);
    else;
      xp(i,j) = x(i,j);
      xn(i,j) = 0;
    end;
  end;
end;

hh = [];
cc = [];
a = []; b = []; c = []; d = []; e = []; f = [];
hold on
if ~isempty(find(clev > 0));
  if (max(max(x)) > clev(find(clev == min(clev(find(clev > 0))))))
    [a, b] = contorm(ya, xa, xp, clev(find(clev)), ['-' s]);
    if lab; clabelm(a, b, 'manual'); end;
    set(b,'linewidth',lw);
  end;
end

if ~isempty(find(clev < 0));
  if (min(min(x)) < clev(find(clev == max(clev(find(clev < 0))))));
    [c, d] = contorm(ya, xa, xn, clev(find(clev)), ['--' s]);
    if lab; clabelm(c, d, 'manual'); end;
    set(d,'linewidth',lw);
  end;
end

if ~isempty(find(clev == 0));
  if (max(max(x)) > 0) & (min(min(x)) < 0 & ismember(0,clev) )
    [e, f] = contorm(ya, xa, x, [0 0], ['-' s]);
    if lab; clabelm(e, f, 'manual'); end;
    set(f,'linewidth',2*lw);
  end;
end;

if nargout > 0;
  hh = [a c e];
  cc = [b; d; f];
end

%hold off
grid on;