Global Index (short | long) | Local contents | Local Index (short | long)
[cc, hh] = pncontm(xa, ya, x, clev, lab, s);
[c, h] = pncont(xa, ya, x, clev, lab, s); 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 pncont(xa, ya, x, clev, lab, s) s is a line color
function [cc, hh] = 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; %xp = x; %xn = x; %xp(x <= 0) = 0; %xn(x >= 0) = 0; % First, determine if hold is 'on', or 'off'. next_ax = lower(get(gca, 'NextPlot')); if strcmp(next_ax, 'replace'); cla; end; set(gca, 'NextPlot', 'add'); hh = []; cc = []; a = []; b = []; c = []; d = []; e = []; f = []; if any(clev > 0); if max(max(x)) > min(clev(clev > 0)); [a, b] = contorm(ya, xa, x, clev(clev > 0), ['-' s]); if lab; clabelm(a, b, 'manual'); end; set(b,'linewidth',lw); end; end if any(clev < 0); if min(min(x)) < max(clev(clev < 0)); [c, d] = contorm(ya, xa, x, clev(clev < 0), ['--' s]); if lab; clabelm(c, d, 'manual'); end; set(d,'linewidth',lw); end; end if any(clev == 0); if all([max(max(x)) > 0 , min(min(x)) < 0]) [e, f] = contorm(ya, xa, x, [0 0], ['-' s]); if lab; clabelm(e, f, 'manual'); end; set(f,'linewidth',2*lw); end; end; set(gca, 'NextPlot', next_ax); if nargout > 0; cc = [a c e]; hh = [b; d; f]; end grid on;