how is the frequency vector and index vector derived?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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])
2 commentaires
KSSV
le 19 Mai 2020
You try simly plotting plot(FTs).
The above will give you two symmetric frequency plots. We need to pick only half of the plot. The steps you have mentioned are to pick the half of the plot. And divison is to normalize the frequency plot.
Réponses (0)
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!