Plot是matlab裏常用的命令~
可以通過help plot來查詢關於plot繪圖的相關命令
help plot
推薦大家自己畫畫圖測試一下~
而且這些命令是可以疊加使用的。即
plot(x,y,'bo');
可以畫出藍色的圓圈形狀圖線。
除了matlab自帶的這8種顏色,如果需要更豐富的顏色畫線,可以使用'color'參數來自定義線條顏色,可以參考這篇博客園的文章。
http://www.cnblogs.com/takeaction/p/3789871.html
那麼問題來了,如果採用'color'參數來制定RGB顏色的話只能得到實線,如果我希望用自定義顏色來實現不同線型,即RGB與線型結合的話,該如何實現呢?
一開始我類比之前的辦法,在
plot(x,y,'coloro',[0 1 0]);
或者
plot(x,y,'color',[0 1 0],'o');
均不能達到目的
後來發現把線型參數放到‘color’之前可以實現我的目的,即
plot(x,y,'o','color',[0 1 0]);
這樣就會發現你的matlab可以實現各種顏色咯!
下面~畫一個光盤反面好了。
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種顏色。RGB隨機。 for idx = 1:Num theta = pi/N/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
複製運行一下。嘿嘿~