How to plot vertical line from X Axis to values on graph?

조회 수: 6 (최근 30일)
ImperialStar
ImperialStar 2019년 12월 28일
댓글: Star Strider 2019년 12월 28일
Hi,
Ive got a fft plot with values linked by a line however, I would like the values to be plotted as a straight vertical line down to the x axis so that it just shows each frequency. I havent been able to find a possible way of doing this anywhere. Help on how to do this is very much appreciated.

채택된 답변

Star Strider
Star Strider 2019년 12월 28일
The easiest way to do this is to use the stem function.
Example —
f = 0:0.05:pi; % Create Frequency Vector
A = rand(size(f)); % Create Fourier Transform Amplitude Vector
figure
plot(f, A, '-b')
hold on
stem(f, A, '-r', 'Marker','none') % Plot ‘stem’ Without Markers
hold off
grid
This plots the Fourier transform amplitudes with a blue line, and with red stem lines. Change the various properties to get the result you want.
  댓글 수: 2
ImperialStar
ImperialStar 2019년 12월 28일
Ah perfect! Much appreciated.
Star Strider
Star Strider 2019년 12월 28일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by