Hi,
You can use the "hsv" function to create a cyclic rainbow color palette, as the HSV color space is naturally cyclic with respect to hue.
rainbowPalette = hsv(numColors);
x = linspace(0, 2*pi, 1000);
scatter(x, y, 10, mod(1:1000, numColors)+1, 'filled');
colormap(rainbowPalette);
In this example, "hsv(numColors)" generates a "numColors x 3" matrix, where each row is an RGB color corresponding to a color in the HSV color wheel. The colors range from red, through all the hues of the rainbow, back to red, creating a cycle.
Hope this helps!