2014-11-05 54 views
0

我試圖繪製的信號和標誌峯位置如下圖所示:enter image description here情節的信號和標誌峯位置

我已經有了信號,價值觀和各峯的位置,但我無法將它們放在同一個圖表中,有幫助嗎?

我的代碼:

%signal is a vector which carries all the points of the signal 
figure; 
[PKS,LOCS] = findpeaks(signal); 

回答

1

是它不只是對現有信號圖的頂部繪製峯的事?例如:

plot(t,signal,'b-',t(LOCS),signal(LOCS),'bv'); 
+0

非常感謝@am ..它工作得很好,但它可以繪製不同顏色的三角形? – SMH 2014-11-05 11:28:14

+0

是的,只需將'bv'改成'rv'或任何你想要的。有關更多詳細信息,請參閱http://www.mathworks.co.uk/help/matlab/ref/plot.html#inputarg_LineSpec上的文檔。如果解決了您的問題,請接受答案。 – am304 2014-11-05 11:29:29

+0

許多感謝@am ..它現在很好 – SMH 2014-11-05 11:31:23