Help me undersandand Frequency Vector and index vector in fourier transform

조회 수: 15 (최근 30일)
I have strated learning and I am new to Matlab and fourier transform I am Struggling to understand the concept of the frequency vector and index vector in this code below. I will be grateful if someone can explain what is frequency vector (Fv) and index vector (Iv) and what the code for both at Fv, Iv and FTs_plot is doing.
L = numel(t); % Vector Length
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTs = fft(s)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
FTs_plot = abs(FTs(Iv))/max(abs(FTs(Iv))); % Normalised Fourier Transform

채택된 답변

Star Strider
Star Strider 2020년 5월 25일
That is my code, so I will do my best to explain it.
The frequency vector ‘Fv’ here defines the frequencies for a one-sided Fourier transform, going from 0 Hz (d-c) to the Nyquist frequency. The length is determined by half the length of the original signal vector (+1 since it begins at 0). (Since the time vector is always a vector and not a matrix, and the signal could be a matrix, it is easier to use the time vector to determine the length of the signal.) The length of the two-sided Fourier transform (most easily appreciated after using fftshift on it) is the same as the length of the original signal vector (unless the length is increased by zero-padding it, that being a separate discussion).
The index vector ‘Iv’ just makes plotting and other references to the one-sided fft result easier. It is equal to the number of elements in the frequency vector, so the lengths match when plotted or otherwise processed.
With respect to ‘FTS_plot’, I am not certain what this code refers to (with this, I will have posted 13495 Answers, and I do not remember all of them), however it appears that it was intended to plot the normalised fft, so that the highest value is 1 and everything else is between 0 and 1. That is not how I usually plot fft results, so there must have been a specific reason for it.
If you have any further questions about my code here, I will do my best to address them.
  댓글 수: 4

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by