what is the x-axis in the figure represent ? frequency, samples?

1 Ansicht (letzte 30 Tage)
Hi all....
I so confusing really!
I Have this code
Fs = 20000;
t = 0:1/Fs:0.01;
fc1=200;
x = 10*sin(pi*fc1*t)
xFFT = abs(fft(x));
x_psd = abs(fft(x).^2);
stem(xFFT);
stem(x_psd);
1.let we say this simple HW, what is the x-axis of xFFT represent(frequency or samples SPS)? 2.can I say this signal of frequency 100 ,sampling frequency 20000,number of samples 201? 3.How can find resolution of this can I say (Fs/number of samples N) is resolution, if not resolution how can find resolution ?
than you

Akzeptierte Antwort

Mohammad Abouali
Mohammad Abouali am 26 Nov. 2014
the way that you are using stem function, the x axis would be the index number.
So your xFFT is an array of 201 double precision numbers. the x axis is from 1 to 201.
So pretty much you can interpret it as sample number.
use this form:
stem(xValues, YValues)
if you want to show something else as your x-axis.
Two more thing (not in your question)
1) usually use fftshift before plotting your stuff.
2) You have two calls to stem() function. The second one will override the first one. So either use 'hold on' to have both graph in one figure or if you want them in two separate figure then change it to something like this:
figure, stem(xFFT);
figure, stem(x_psd);
  3 Kommentare
Mary Jon
Mary Jon am 26 Nov. 2014
why use fftshift?
how can made x axis in frequency unite

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by