Fourier Transform of Seismic Waves

16 views (last 30 days)
Nerma Caluk
Nerma Caluk on 28 Jun 2022
Edited: Jonas on 29 Jun 2022
I have data that is in general units called Digital Units vs Milliseconds, which I need to convert to ground acceleration and apply filtering. However, the first step is to convert the data from time-domain to freqency-domain. I have used the Excel file "TestFile.xlsx" which I have attached, to generete the original plot, and compute the single-sided spectrum P1 based on Ps and even-valued signal length (L) as recommneded by the MATLAB Help. However, I get a plot that does not make much sense to me, and I am not sure if I need to fix something.
This is the code that I did:
close all
clear
clc
filename = 'TestFile.xlsx';
% Load excel table
M = readtable(filename);
%disp(T);
% Load column as vectors
ms = table2array(M(:,1)); % Time Vector
lpx = table2array(M(:,2)); % Signal + Noise
T = 604; % Sampling Period
Fs = 1/T; % Sampling frequency
L = 4211;
%t = (0:L-1)*T
figure
plot(ms,lpx)
title('Original signal before filtering')
xlabel('t millisecond')
ylabel('Digital Units')
% Computing Fourier transform of signal
Y = fft(lpx);
%Compute the single-sided spectrum P1 based on P2 and the even-valued
%signal length L
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
figure
f = Fs*(0:(L/2))/L;
plot(f,P1)
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f(Hz)')
ylabel('|P1(f)|')

Answers (1)

Jonas
Jonas on 28 Jun 2022
Edited: Jonas on 29 Jun 2022
subtract the mean before fft to improve visibility of frequencies or use dB view by calculating 20*log10(P1)
explanation: the DC part (the mean part) of the signal is much higher compared to the amplitude of the oscillation. The Mean part is the amplitude value at f==0 Hz in the spectrum

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!