MATLAB: How to insert RGB percentage colors in a vector

rgb colors in vector

Hello, I wrote a code that produces polynomiographic drawings of input polynomials I put all the colors in a vector that are coded with a letter but i want more colors so i can input polynomials of higher grades but nothing seems to work. here is the code i have
function [ y ] = polyn( f,df,c)
nulpt=roots(c);
k=['r' 'y' 'b' 'g' 'm' 'c' 'w' 'k'];
d=numel(nulpt);
for a=(-1.5:10^(-2):1.5)
for b=(-1.5:10^(-2):1.5)
x=a+b*1i;
y=newton(f,df,x);
for l=1:d
if abs(y-nulpt(l))<10^(-2)
plot(a,b,'.', 'Color', k(l))
hold on
end
end
end
end
end
this works fine but i want more colors in k i have tried naming a color like r=[1 1 1] or just put the vector in k but nothing seems to work

Best Answer

You have to make k an N by 3 colormap (array). So if you want certain specific non-standard colors, you can't use letters anymore -- you need 3 numbers.
k = [...
1,0,0
1,1,0
0,0,1
0,1,0
1,0,1
etc....
plot(a,b,'.', 'Color', k(l, :));