FIR(1)

NAME
fir - general-purpose FIR filter for DB 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 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.

-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.

The shell variable DB should be set and exported (see setdb(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)