What are the frequencies when N in fft(x,N) is odd?

40 次查看(过去 30 天)
I know when N is even, fft(x,N) corresponds to frequencies 0,df,...,N/2*df,-(N/2-2)*df,...,-df.
What about if N is odd?

采纳的回答

Honglei Chen
Honglei Chen 2014-7-10
编辑:Honglei Chen 2014-7-10
In general, you can do it as
f = (0:N-1)*fs/N
If you want to map it to negative frequencies
if N is even
f(N/2+1:end) = f(N/2+1:end)-fs % sample -fs/2
or
f(N/2+2:end) = f(N/2+2:end)-fs % sample fs/2
if N is odd
f((N+1)/2+1:end) = f((N+1)/2+1:end)-fs
HTH
  4 个评论
Ray Lee
Ray Lee 2014-7-10
the output of fft is unique, but in the two formulae, the f axis is shifted by one point.
Honglei Chen
Honglei Chen 2014-7-10
编辑:Honglei Chen 2014-7-10
That's not true. Only one point is changed, from fs/2 to -fs/2 and because the result is periodic, they are indeed the same so you can mark it either way

请先登录,再进行评论。

更多回答(1 个)

Michael scheinfeild
if x is ampled at fs you can generate frequency vector use
freqvec=linspace(0,fs,N);

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by