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

조회 수: 5 (최근 30일)
Changhyun Kim
Changhyun Kim 2022년 8월 11일
댓글: William Rose 2022년 8월 15일
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.

답변 (1개)

William Rose
William Rose 2022년 8월 11일
편집: William Rose 2022년 8월 15일
data=xlsread('GYEONGJU(MKL).xlsx');
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.
  댓글 수: 5
William Rose
William Rose 2022년 8월 12일
I did answer the quesiton you posted here, so you could accept it, and should acept it, if you agree that I aswered it. You can consider my answer to your other qustion separately. Thank you.
William Rose
William Rose 2022년 8월 15일
I deleted the file GYEONGJU(MKL).xlsx from my comment, as you requested.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Seismology에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by