MATLAB: Is it possible to get the FFT(amplitude-frequency) in MAT LAB using vibration signal data (amplitude-time) and data is in *.txt format is hereby attached.


here by vibration signal amplitude-time *.txt file is attached.I used piezoelectric sensor to acquire this data.I need to find maximum amplitude and frequency using FFT in MAT LAB.Please solve this.

Best Answer

data = importdata('data.txt') ;
t =,1) ;
amp =,2) ;
L = length(t) ;
dt = max(diff(t)) ;
Fs = 1/dt ;
Y = fft(amp);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
xlim([0 100])
Related Question