MATLAB: Ask help to do the fft on the ‘untreatable’ data

exponential decayfft

Hi there,
anyone could help me to do the fft on my data, i tried the normal methed, it never work out…
the time step is 0.0001 second.
Thanks a lot in advance!
Regards,
Pengju

Best Answer

Try this:
D = load('data.txt');
t = D(:,1);
s = D(:,2);
L = numel(t);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
FTs = fft(s-mean(s))/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
[pks,locs] = findpeaks(abs(FTs(Iv))*2, 'MinPeakProminence',0.001);
figure
plot(t, s)
grid
xlabel('Time (s)')
ylabel('Amplitude')
title('Time Domain')
figure
plot(Fv, abs(FTs(Iv))*2)
hold on
plot(Fv(locs), abs(FTs(locs))*2, '^r', 'MarkerFaceColor','r')
hold off
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Frequency Domain')
xlim([0 1500])
Make necessary changes to get the result you want.