Because the color syntax can be expressed as letters such as k, g, b etc. and also as a three element row, which indicate the RBG mode, such as [1, 0, 1], [0.1,0.7, 0.4] and so on.
So here I wrote a M-file to randomize the color and plot 10 curves in each subplot.
%this code produce a three element row
%which can be used to specify a random color
%created on 02/15/2010
function rndclr=f()
rndclr=[rand, rand, rand];
%this code draws some curves
%of random color
clf
t=0:0.01:100*pi;
for j=1:9
for i=1:10
hold all;
x=(i+2)*cos(t/i)+cos((i-1)*t);
y=i*sin(t/i)+sin((i-3)*t);
subplot (3,3,j);
plot(x,y,'color',rndclr)
axis('equal')
axis off
end
end
And here is the figure:

actually really helped me, just needed to use [rand,rand,rand] when trying to make a plot with n differently coloured graphs
ReplyDeleteI'm very glad to hear that!
ReplyDeleteThanks for commenting, Meredith.
Thanks! This is just what I needed, quick and helpful :)
ReplyDeleteI am glad to hear that, Dear Anonymous person :)
ReplyDeleteThanks.. it helped me too..
ReplyDeleteThe [rand rand rand] was helpful for me too, thanks for that.
ReplyDelete