function plot3c(x,y,z)
%This does a point plot in three dimensions with a red-to-blue color scheme
%(the maximum point being red and the lowest point being blue). The inputs
%are the x,y, and z coordinates that you would usually input into the
%normal plot3 command (see Matlab help for definition).
z=real(z);
M=max(z);
m=min(z);

z0=(z-m)/(M-m);

b=inline('max(1-2*x,0)','x');
g=inline('min(2*x,2-2*x)','x');
r=inline('max(2*x-1,0)','x');

hold off
hold on
for n=1:1:max(size(z))
    plot3(x(n),y(n),z(n),'.','Color', [r(z0(n)) g(z0(n)) b(z0(n))])
end