File Exchange

image thumbnail

AUTODETECT BANDPASS FILTER CORNER FREQUENCIES

version 1.0.8 (239 KB) by Dr. Erol Kalkan, P.E.
cornerFreqs automatically detects appropriate bandpass filter corner frequencies by comparing signal's spectrum with noise spectrum.

16 Downloads

Updated 22 Feb 2019

View License

cornerFreqs automatically detects appropriate bandpass filter corner
frequencies by comparing the input signal's spectrum with the noise spectrum.

MOTIVATION:

Processing of seismic waveforms often requires bandpass filtering.
Selection of filter corner frequencies has been not only a manual
process but also subjective. There is a need for automatically
detecting corner frequencies for processing a large number of seismic
recordings.

ALGORITHM:

First, "PphasePicker" function (Kalkan, 2016) is used to determine
P-phase arrival time (event onset) to get the background noise. Next, Fourier amplitude spectra for noise and signal are calculated. These two spectra are smoothed using "smoothSpectra" function. Finally, intersection points of the smoothed spectra within low-pass and high-pass frequency regions are searched to determine the appropriate corner frequencies to be used for bandpass filtering.

High-pass region is defined between 0.1 Hz and 1 Hz. If no intersection
point detected, default value of 0.1 Hz is used.

Low-pass region is defined between the characteristic frequency
of the recording instrument (fc) (often 25 Hz) and Nyquist (half of
sampling frequency of waveform data). If no intersection point detected, 80% of Nyquist is used.

This code uses the following external functions:

[1] PphasePicker.m --> This function computes P-Phase onset time,
also available at MatLAB FEX

[2] smoothSpectra.m --> This function smooth FAS using Konno-Ohmachi
window, also available at MatLAB FEX

USAGE:

[hp_freq, lp_freq] = cornerFreqs(x,dt)

STATIC INPUT:

x = broadband velocity or acceleration data in
single-column format (1xn) or (nx1)
dt = sampling interval in second (e.g., 0.005)

VALID PROP_NAME / PROP_VAL PAIRS:
-----------------------------------------
'plot_name' --> [text]-[default: None]
'plot_path' --> [text]-[default: None]
'debug' --> [text]-[default: False]

OUTPUT:

hp_freq = high-pass corner frequency in Hz
lp_freq = low-pass corner frequency in Hz

EXAMPLES:

see demo.m file

REQUIREMENTS:

cornerFreqs function does not require any MatLAB toolbox.

ACKNOWLEDGEMENT:

In preparing this function, I benefitted from Curve Intersections
(InterX.m) function written by NS, which is available at MathWorks FEX.

REFERENCE:

Kalkan, E. (2016). “An Automatic P-phase Arrival Time Picker“, Bulletin of Seismological Society of America,106(3): 971-986, doi: 10.1785/0120150111

If you find this code useful for your application, please don't forget to rate it.
For questions / suggestions / comments and bug reports: kalkan76@gmail.com

Cite As

Dr. Erol Kalkan, P.E. (2019). AUTODETECT BANDPASS FILTER CORNER FREQUENCIES (https://www.mathworks.com/matlabcentral/fileexchange/70270-autodetect-bandpass-filter-corner-frequencies), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

MM xu

great work!

Updates

1.0.8

code is even more simplified

1.0.7

Updated notes, fixed typo.

1.0.6

Bug fixed

1.0.5

More updates on the notes

1.0.4

Updated notes

1.0.3

Updated notes

1.0.2

Updated notes

1.0.1

Plp and Php computations updated for speed

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux