FFT and sin wave

조회 수: 5 (최근 30일)
i Venky
i Venky 2011년 10월 11일
A small doubt in signal processing. When you take fft of a signal -- k=fft(y,512); and plot it, we get 512 points. I want to represent the 'x' axis in Hz . How would you do that? For eg: if k=40 what is the the corresponding frequency in Hz for a 512 point FFT?

채택된 답변

Wayne King
Wayne King 2011년 10월 11일
If the signal is real-valued:
t = 0:.001:1-0.001;
Fs = 1e3;
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
freq = 0:Fs/length(x):Fs/2;
plot(freq,abs(xdft));
xlabel('Hz');
  댓글 수: 1
Wayne King
Wayne King 2011년 10월 11일
Frequencies are spaced at Fs/N where Fs is the sampling frequency and N is the length input signal.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

i Venky
i Venky 2011년 10월 11일
This is okay when the no of points in the fft is same as that of the length of the input signal. When I change the no of points in the fft. For eg: in your code if I change xdft=fft(x) into xdft=fft(x,512), what should be the change that I should make to get the frequency in Hz?

i Venky
i Venky 2011년 10월 11일
I got it.
Frequency in Hz= k * Sampling frequency (in time domain)/ N
Where 'N' is the no of points in the FFT.
  댓글 수: 1
Wayne King
Wayne King 2011년 10월 11일
Yes, but just keep in mind that the frequency resolution of your DFT is determined by the length of your input signal, NOT by the value of any zero padding. Zero padding just interpolates your DFT, it does not give you any better resolution.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by