function M=hsvmap(maphalfsize,deadzone,color1,color2)
%given a maphalfsize, creates a colormap going from white to red on one
%side and blue on the other.
%color1 is used for positive and color2 for negative. Both are entered as
%rgb values so you can adjust what colors you wish to use.
%hsvmap(20,10,[1 0 0],[0 0 1]) gives a colormap with 20 gradiations of red
%representing positive and 20 gradiations of blue representing negative,
%with a pure white deadzone of 10 values.
grad=0:1/maphalfsize:1;
grad=grad(2:size(grad,2));
grad=grad';
c1=rgb2hsv(color1);
c1=c1(1);
c2=rgb2hsv(color2);
c2=c2(1);
hmap=[ones(size(grad))*c2 flipud(grad) ones(size(grad));
zeros(deadzone,1) zeros(deadzone,1) ones(deadzone,1);
ones(size(grad))*c1 grad ones(size(grad))];
M=hsv2rgb(hmap);