Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
fft plotting

Subject: fft plotting

From: Giorgia

Date: 24 Aug, 2012 15:58:07

Message: 1 of 1

Hi all,
I'm working with the FFT and I'm not really an expert. Once I compute the fft and the modulus(abs), now I'd like to plot the the modulus with the right values on the x-ass.

if I think of a code simple like this :


fs = 1/step; % sampling frequency (step = time sample)
y = fft(singal);
abs_y = abs(y);

QUESTION
1. knowing the sampling frequency how can I obtaing a proper vector to plot abs(y)?

it might be correct to do

f = 0 : fs/length(signal) : fs - fs/length(signal); ???
is this the same as doing as shown in the the matlab example?
f = Fs/2*linspace(0,1,NFFT/2+1)

2. I've seen in the matlab example for the fft, why the fft has been divided by the length of the signal?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us