How can I connect the points in the merged stem graph

5 次查看(过去 30 天)
Below is part of my code.
Do_FFT is a self-defined function for doing FFT.
[P1,f_axis] = Do_FFT(file,fs,0);
stem(f_axis,P1,'g');
hold on;
[Pf,f_axisf] = Do_FFT(file,fs,1,0.5);
stem(f_axisf,Pf);
[Pf,f_axisf] = Do_FFT(file,fs,1,0.5);
stem(f_axisf,Pf,'r');
Just ignore title and legends of the image.
I'd like to know how to draw a line to connect all of the points. Thanks a lot.

回答(1 个)

KSSV
KSSV 2018-6-5
Use hold on and plot data.
figure
X = linspace(0,2*pi,50)';
Y = cos(X) ;
stem(X,Y)
hold on
plot(X,Y,'r')
  1 个评论
Wei-Min Chen
Wei-Min Chen 2018-6-5
Hi,
It seems like this approach only can connect the line from individual data. Now I have three stem graphics, their colors are 'r','g','b' respectively.
Can I connect them? Or I should plot them by using only one stem cmd, then plot(X,Y,'r') like you say?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by