Skip to content

Commit 8ddce88

Browse files
committed
Document stateful filter
1 parent 73140ce commit 8ddce88

File tree

2 files changed

+46
-14
lines changed

2 files changed

+46
-14
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# DSP v0.0.8 Release Notes
2+
3+
- The `DF2TFilter` object provides a filter that preserves state
4+
between invocations ([#100](https://github.com/JuliaDSP/DSP.jl/pull/100)).
5+
16
# DSP v0.0.7 Release Notes
27

38
- Filter coefficient types have been renamed to distinguish them from implementations ([#96](https://github.com/JuliaDSP/DSP.jl/pull/96)):

doc/filters.rst

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
:mod:`Filters` - filter design and filtering
22
============================================
33

4-
Linear time-invariant filter representations
5-
--------------------------------------------
4+
DSP.jl differentiates between filter coefficients and filters. Filter
5+
coefficient objects specify the response of the filter in one of
6+
several standard forms. Filter objects carry the state of the filter
7+
together with filter coefficients in an implementable form
8+
(``PolynomialRatio``, ``Biquad``, or ``SecondOrderSections``).
9+
When invoked on a filter coefficient object, ``filt`` preserves state
10+
between invocations.
611

7-
DSP.jl supports common filter representations. Filters can be converted
8-
from one type to another using ``convert``.
12+
Linear time-invariant filter coefficient objects
13+
------------------------------------------------
14+
15+
DSP.jl supports common filter representations. Filter coefficients can
16+
be converted from one type to another using ``convert``.
917

1018
.. function:: ZeroPoleGain(z, p, k)
1119

@@ -45,28 +53,45 @@ from one type to another using ``convert``.
4553
sections and gain. ``biquads`` must be specified as a vector of
4654
``Biquads``.
4755

56+
57+
Filter objects
58+
----------------------------------
59+
60+
.. function:: DF2TFilter(coef[, si])
61+
62+
Construct a stateful direct form II transposed filter with
63+
coefficients ``coef``. ``si`` is an optional array representing the
64+
initial filter state (defaults to zeros). If ``f`` is a
65+
``PolynomialRatio``, ``Biquad``, or ``SecondOrderSections``,
66+
filtering is implemented directly. If ``f`` is a ``ZeroPoleGain``
67+
object, it is first converted to a ``SecondOrderSections`` object.
68+
69+
4870
Filter application
4971
------------------
5072

5173
.. function:: filt(f, x[, si])
5274

53-
Apply filter ``f`` along the first dimension of array ``x``. ``si``
54-
is an optional array representing the initial filter state
55-
(defaults to zeros). If ``f`` is a ``PolynomialRatio``, ``Biquad``,
56-
or ``SecondOrderSections``, filtering is implemented directly. If ``f`` is a
57-
``ZeroPoleGain``, it is first converted to an ``SecondOrderSections``.
75+
Apply filter or filter coefficients ``f`` along the first dimension
76+
of array ``x``. If ``f`` is a filter coefficient object, ``si``
77+
is an optional array representing the initial filter state (defaults
78+
to zeros). If ``f`` is a ``PolynomialRatio``, ``Biquad``, or
79+
``SecondOrderSections``, filtering is implemented directly. If
80+
``f`` is a ``ZeroPoleGain`` object, it is first converted to a
81+
``SecondOrderSections`` object.
5882

5983
.. function:: filt!(out, f, x[, si])
6084

6185
Same as :func:`filt()` but writes the result into the ``out``
6286
argument, which may alias the input ``x`` to modify it in-place.
6387

64-
.. function:: filtfilt(f, x)
88+
.. function:: filtfilt(coef, x)
6589

66-
Filter ``x`` in the forward and reverse directions. The initial
67-
state of the filter is computed so that its response to a step
68-
function is steady state. Before filtering, the data is
69-
extrapolated at both ends with an odd-symmetric extension of length
90+
Filter ``x`` in the forward and reverse directions using filter
91+
coefficients ``f``. The initial state of the filter is computed so
92+
that its response to a step function is steady state. Before
93+
filtering, the data is extrapolated at both ends with an
94+
odd-symmetric extension of length
7095
``3*(max(length(b), length(a))-1)``.
7196

7297
Because ``filtfilt`` applies the given filter twice, the effective
@@ -84,6 +109,7 @@ Filter application
84109
choosing the optimal algorithm based on the lengths of ``b`` and
85110
``x``.
86111

112+
87113
Filter design
88114
-------------
89115

@@ -95,6 +121,7 @@ Filter design
95121

96122
Construct a digital filter.
97123

124+
98125
Filter response types
99126
---------------------
100127

0 commit comments

Comments
 (0)