function J = posneg(m)
% posneg   colormap similar to jet, but with white instead of green in the center
%   useful for showing positive/negative values (use symmetric caxis)
%   posneg(M), a variant of HSV(M), is an M-by-3 matrix 
%   posneg, by itself, is the same length as the current figure's
%   colormap. If no figure exists, MATLAB creates one.

if nargin < 1
   m = size(get(gcf,'colormap'),1);
end

x = linspace(-2.5,2.5,m)';        % consider x in [-2.5,2.5]
f = @(x) max(0,min(1,2-abs(x)));  % function for green
J = [f(x-1),f(x),f(x+1)];

