FFT of a damping signal
27 views (last 30 days)
Show older comments
Hello, I have got a damping time dependent signal(attached data) and I wish to get the FFT of the signal. Unfortunately right now I am not able to get the peak frequency. Can someone help me in finding the FFT please.
2 Comments
Accepted Answer
Star Strider
on 1 Aug 2017
Try this:
D = load('FFT.txt');
t = D(:,1);
s = D(:,2);
Ts = mean(diff(t)); % Sampling Time
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
L = length(t);
FTs = fft(s)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
[pks,locs] = findpeaks(abs(FTs(Iv))*2, 'MinPeakHeight',1E-3);
figure(1)
loglog(Fv, abs(FTs(Iv))*2)
hold on
plot(Fv(locs), pks, '^r')
grid
text(Fv(locs)*1.1, pks, sprintf('\\leftarrow Peak = %.5f at %.3E Hz', pks, Fv(locs)), 'HorizontalAlignment','left')
6 Comments
More Answers (0)
See Also
Categories
Find more on Spectral Measurements 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!