Hi, I have a curve of dimension 50x2, and a specification of the colors at certain positions. For example, at position 1 the color is [1,0,0] and at position 30, the color is [0,1,0] and at position 50 the color is [0,0,1]. I would like to plot this curve such that, at positions 1, 30 and 50, they have the specified colors, while at other positions, the colors are interpolated. And optimally I would like to have continuous plot rather than dividing the curve into segments.
I read from this trick that you can plot it as a surface with no face color, but I have no idea how would you specify the colors with this method. In th trick they have: x = 0:.05:2*pi;
y = sin(x);
z = zeros(size(x));
col = x;
surface([x;x],[y;y],[z;z],[col;col],...
'facecol','no',...
'edgecol','interp',...
'linew',2);
I don't understand why they need [x;x] instead of just x, y and z, but removing the additional x the trick fails. Does anyone have some ideas on solving this problem?
Thank you very much!