I just started learning Matlab and I want to know is there an easy way to vary the color of the scatter plot, for example, from yellow to red. I was thinking about using the command
scatter(x,y,100,c)
where c would be defined as an RGB triplet
t=linspace(0,1,100);
c='y' .* (1-t) + 'r' .* t;
Now this does something, but it doesn't really gives changes the color gradually from yellow to red. If there is an easier way or even some custom function that does this automatically, that would be great. Thanks.