MATLAB: Colorbar with three colors

colobar

I am using surf plot the pictures. I want to see the colorbar at the right-hand side. But the transition of the color is not so obvious. I want to see from green to red, and there is another color in the middle. How can I do this?
Thanks!

Best Answer

Z = peaks(100) ;
surf(Z)
shading interp
cmap = [1 0 0 ; 0 1 0 ; 0 0 1] ;
colorbar
colormap(cmap)