필터 지우기
필터 지우기

why we need to multiply x axis with SAmpling frequency and divide it by length of FFT

조회 수: 13 (최근 30일)

Im new to matlab im doing a simple FIR design i got stuck at particularly one line that is
nfft = 2.^nextpow2(length(x));
fy = fft(x,nfft);
fy = fy(1:nfft/2);

xfft = Fs*(0:nfft/2-1)/nfft;%why????????????

plot(xfft,abs(fy/max(fy)));

% Im not getting why xfft is calculated in that way sombody please help!!

  댓글 수: 1
cr
cr 2022년 12월 1일
편집: cr 2022년 12월 1일
Remove the multiplication and division and see what you get. Try and interpret the result. Introduce the multiplication and division one at a time and see how it affects the result. #joyoflearning

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

답변 (1개)

V Sairam Reddy
V Sairam Reddy 2022년 12월 8일
Hi Abhay,
I understand that you want to know why Fs/N is being multiplied to the X-axis.
Here are some things to help you understand:
  • The number of points in the time domain equals to number of points in frequency domain which is N.
  • The FFT shows frequency domain view of time domain signal in frequency space of -Fs/2 to Fs/2.
  • This frequency space is split into N equally spaced points leading to a gap of Fs/N between the consecutive points.
  • That means, if a frequency component is at freq=0, the next component will be at freq=1*Fs/N, the next will be at freq=2*Fs/N, and it goes on till (N-1)*Fs/N.
  • The frequency spectrum is periodic, hence all the components from [-Fs/2, 0] are again repeated in [Fs/2, Fs].
  • The FFT function gives the positive frequency components first and then the symmetric negative frequency components making the frequency range [0, Fs]. Hence, we only consider first half of the spectrum.
  • Hence the X-axis corresponds to the frequencies and the Y-axis corresponds to the magnitude of that corresponding frequency present in the signal.
Hope this helps you understand. Please refer to this MATLAB Answer - If a fft of vector x is plotted then what would be the x-axis? to get some more insights.

카테고리

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