Contributions:IIRFilter ML

From BCI2000 Wiki
Revision as of 15:15, 19 August 2019 by Mellinger (talk | contribs) (Created page with "==Synopsis== A finite impulse response (IIR) filter for temporal filtering that behaves like Matlab's <tt>filter()</tt> function. ==Location== http://{{SERVERNAME}}/svn/trunk...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

A finite impulse response (IIR) filter for temporal filtering that behaves like Matlab's filter() function.

Location

http://www.bci2000.org/svn/trunk/src/contrib/SignalProcessing/IIRFilter_ML

Versioning

Authors

Juergen Mellinger

Source Code Revisions

  • Initial development: 6005
  • Tested under: 6008
  • Known to compile under: 6008
  • Broken since: --

Matlab filter() Function

The Matlab filter() function is a direct form II transposed implementation of the IIR difference equation. If a_{1..n} are the denominator coefficients of the filter polynomial, and b_{1..n} are the numerator coefficients of the filter polynomial, and the shorter of the two is padded with zeros, then the direct form II implementation computes the filter's output at sample m as


\begin{align}
y(m) &= b(1) x(m) + w_1(m-1) \\
w_1(m) &= b(2) x(m) + w_2(m-1) - a(2) y(m)\\
\cdots{} \\
w_{n-2}(m) &= b(n-1) x(m) + w_{n-1}(m-1) - a(n-1) y(m)\\
w_{n-1}(m) &= b(n) x(m) - a(n) y(m)
\end{align}

where x is the input, y is the output, and w_{1..n-1} are the filter delays.

Parameters

NumeratorB

List of numerator coefficients for the filter polynomial. Corresponds to the b parameter of the Matlab filter() function.

DenominatorA

List of denominator coefficients for the filter polynomial. Corresponds to the a parameter of the Matlab filter() function. The list must contain at least one value, and that value must be nonzero. All coefficients of the filter polynomial will be normalized dividing by the first entry of DenominatorA.

NumeratorB and DenominatorA coefficients will be applied to all channels; it is not possible to specify indiviual coefficients for channels.

DelaysZi

Matrix of individual initial values of the filter delays. Corresponds to the zi parameter of the Matlab filter() function. Columns correspond to channels, rows correspond to delays.

If empty, filter delays are filled with zeros. At the end of each run, the DelaysZi parameter is updated with the current values of the delays, i.e. the value of the zf parameter in Matlab.

States

None.

See also

User Reference:Filters, Contributions:SignalProcessing