what is the x-axis in the figure represent ? frequency, samples?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Mohammad Abouali
2014-11-26
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!