How to plot line spectrum in matlab ?

I would like to plot a spectrum (output of FFT) with a form like the provided image. How do I do it? Because the common plot in matlab is connecting of all point.

Answers (2)

Use the stem (link) function for the plot.
Example
f = 0:0.1:3.5; % Create Frequency Vector
h = exp(-f) + 0.5*rand(size(f)); % Create Amplitude Vector
figure
stem(f, h, 'Marker','none')

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products

Release

R2016b

Asked:

on 9 Nov 2018

Answered:

on 9 Nov 2018

Community Treasure Hunt

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

Start Hunting!