Next: GQFUSE(1) Up: WFDB Applications Guide Previous: FFT(1)On This Page

Name

fir - general-purpose FIR filter for WFDB records

Synopsis

fir [ options ... ] -c [ coefficients ... ]

Description

fir can be used to apply any desired finite impulse response filter to any desired section of a waveform database record. Options are:
-c coefficient [ coefficient ... ]
Filter using the specified coefficients (must be the last option; -c marks the beginning of the coefficient list).
-C file
Read the filter coefficients from the specified file rather than from the argument list.
-f time
Filter from the specified time on the input record (default: start at the beginning of the record).
-h
Print a usage summary.
-H
Read the signal files in high-resolution mode (default: standard mode). These modes are identical for ordinary records. For multifrequency records, the standard decimation of oversampled signals to the frame rate is suppressed in high-resolution mode (rather, all other signals are resampled at the highest sampling frequency).
-i record
Use the specified record for input (default: record 16).
-n record
Create a header file for the output signals, with the specified record name. The signal descriptions are copied from those of the input signals.
-o record
Use the specified record for output (default: record 16).
-ri
Rectify the input (i.e., take its absolute value) before filtering.
-ro
Rectify the filtered output.
-s shift
To compensate for phase shift, read ahead on the input record by the specified interval before starting the filter. Shift is specified in standard time format (use snn to compensate for a phase shift of nn samples).
-t time
Filter until the specified time on the input record (default: go to the end of the record).

Unless the -C option is used, the -c argument should appear at the end of the option list. Filter coefficients are real numbers separated by spaces; the last coefficient is applied to the most recent input sample.

In the present implementation, the same filter is applied to each input signal. If the output record header file specifies fewer signals than are present in the input, any extra input signals are discarded.

Environment

It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).

Examples

A low-pass "boxcar" filter:
   fir -c .2 .2 .2 .2 .2

The complementary high-pass filter:
   fir -c -.2 -.2 .8 -.2 -.2

An attenuator:
   fir -c .4

A differentiator:
   fir -c -1 1

A 60-Hz notch filter, with partial correction for phase shift, for the MIT-BIH database (360 samples/second):
   fir -s s2 -c .5 0 0 .5

A "triangle" filter for QRS detection (at 128 samples/second):
   fir -s s8 -c -1 -2 -3 -4 -1 2 5 8 5 2 -1 -4 -3 -2 -1

See Also

mfilt(1)

Author

George B. Moody (george@mit.edu)

Source

http://www.physionet.org/physiotools/wfdb/app/fir.c


Table of Contents

Up: WFDB Applications Guide


Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:

PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 10 June 2022