how is the frequency vector and index vector derived?
Show older comments
Hi All. I am trying to learn Fourier analysis and mathlab, I found the following piece of code on this forum but I can't seem to understand few lines in the code I was hoping you could help me understand.
first, how is the Fv Derived? can someone please help me understand what this piece code is doing
second, similary with index vector
and finally FTs_Plot ; why do we take the abs of FT(iv) dividing it with the maximum of itself?
i think I am able to understand what the rest of the code is doing except for those threee lines.
thanks in advance for your help.
D = load('time_domain.txt');
t = D(:,1);
s = D(:,2);
L = numel(t); % Vector Length
Ts = mean(diff(t)); % Sampling Interval
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
figure
plot(Fv, FTs_plot)
grid
xlim([0 0.5])
Answers (0)
Categories
Find more on Discrete Fourier and Cosine Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!