# how to convert the seismic wave data in Excel to fourier spectra

3 views (last 30 days)
Changhyun Kim on 11 Aug 2022
Commented: William Rose on 15 Aug 2022
I want to convert the seismic wave data in the attached Excel file to the frequency [Hz] on the horizontal axis and the magnitude on the vertical axis by performing FFT in MATLAB. I'm sorry, but I'd appreciate your help.

William Rose on 11 Aug 2022
Edited: William Rose on 15 Aug 2022
N=length(data);
t=data(:,1); %vector of times (s)
x=data(:,2); %vector of x-values
dt=(t(end)-t(1))/(N-1); %sampling interval (s)
f=(0:N-1)/(N*dt); %vector of frequencies (Hz)
X=fft(x); %compute FFT(x)
%% Plot results
plot(f,abs(X))
xlabel('Frequency(Hz)'); ylabel('|X(f)|');
grid on Try the above. As you can see, the FFT is symmetric about the Nyquist frequency, which is always half the sampling frequency . (Actually, the FFT of a real signal is conjugate symmetric about the Nyquist frequency, but we will ignore the phase for now.) Therefore it is common to plot only up to the Nyquist frequency.
William Rose on 15 Aug 2022
I deleted the file GYEONGJU(MKL).xlsx from my comment, as you requested.