Plot is a commonly used command in matlab~
You can query related commands about plot drawing through help plot
- help plot
It is recommended that you draw and test it yourself~
And these commands can be used superimposed. which is
- plot(x,y, 'bo' );
A blue circle shape graph can be drawn.
In addition to the 8 colors that come with matlab, if you need to draw lines with richer colors, you can use the 'color' parameter to customize the line color. You can refer to this blog article.
http://www.cnblogs.com/takeaction/p/3789871.html
So the question is, if I use the 'color' parameter to formulate RGB colors, I can only get solid lines. If I want to use custom colors to achieve different line types, that is, the combination of RGB and line types, how to achieve it?
At the beginning, I compared the previous method, in (note that the rgb value of color in matlab is 0 to 1, corresponding to the standard RGB image value 0-255, which needs to be divided by 255)
- plot(x,y, 'coloro' ,[0 1 0]);
or
- plot(x,y,'color',[0 1 0],'o');
failed to achieve the purpose
Later found that putting the line type parameter before 'color' can achieve my purpose, i.e.
- plot(x,y,'o','color',[0 1 0]);
In this way, you will find that your matlab can achieve various colors!
Below ~ draw a CD on the reverse side.
- qpskConstellation = [-1+1i 1+1i; -1-1i 1-1i]/sqrt(2);
- qpsk = reshape(qpskConstellation,1,[]);
- Num = 40;
- outter = 60;
- for nn = 1:outter
- qpsk = qpsk * (outter-1)/outter;
- c = rand(Num,3); % 12 colors are randomly generated. RGB random.
- for idx = 1:Num
- theta = pi/2/Num*idx;
- rou = [cos(theta) sin(theta);sin(theta) -cos(theta)];
- realPart = real(qpsk);
- imagPart = imag(qpsk);
- reim = rou * [realPart;imagPart];
- realPart2 = real(qpsk*0.3);
- imagPart2 = imag(qpsk*0.3);
- reim2 = rou * [realPart2;imagPart2];
- plot(reim(1,:),reim(2,:),'o','color',c(idx,:));
- hold on;
- plot(reim2(1,:),reim2(2,:),'.','color',c(idx,:));
- hold on;
- pause(0.005);
- end
- end
Copy and run. hehe~