understanding the given algorithm

24 views (last 30 days)
PARVATHY NAIR
PARVATHY NAIR on 4 Jan 2023
Commented: Mathieu NOE on 23 Jan 2023
In the given code ,why there are two filtering process.This is a part of STA/LTA algorithm for earthquake detection which was posted in matlab
clc
clear all
%% Data Inputs
ip = importdata("G:\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\Nepal\ADIB.HHN.dat"); % Data file path
Acc_EW = importdata("G:\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\Nepal\ADIB.HHN.dat");
Acc_NS = importdata("G:\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\Nepal\ADIB.HHN.dat");
Acc_ver = importdata("G:\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\STA-LTA-Algorithm-and-Seismometer-Trajectory-visualization-in-3D-master\Nepal\ADIB.HHN.dat");
Fs = 100; %sampling frequency
%% Signal Pre-Processing
%Filter Design
digfilt = designfilt('lowpassiir', 'PassbandFrequency', 20, 'StopbandFrequency', 25, 'PassbandRipple', 1, 'StopbandAttenuation', 60, 'SampleRate', 200);
% Filtering Data
Acc_EW_filt = filter(digfilt,Acc_EW);
Acc_NS_filt = filter(digfilt,Acc_NS);
Acc_ver_filt = filter(digfilt,Acc_ver);
Fhp = 0.8; % high pass filter cutofff frequency
[b1,a1] = butter(3,Fhp/Fs,'high'); %3rd order high pass butterworth filter
fildat = filter(b1,a1,Acc_ver); % filtered acceleration data
vel = cumtrapz(fildat)./Fs; % Integrating acceleration data for velocity
[b2,a2] = butter(3,Fhp/Fs,'high'); %3rd order high pass butterworth filter
fildat1 = filter(b2,a2,vel); % filtered velocity data
dis = cumtrapz(fildat1)./Fs; % Integrating velocity data for displacement
peakToPeakRange = max(fildat) - min(fildat);
dt = 1/Fs; %sampling time
nt = length(fildat); % length of the input signal
time = (1:nt).*dt; % time duration of the input signal

Answers (0)

Community Treasure Hunt

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

Start Hunting!