Improve initial conditions

Compute the DC gain of the filter (assuming 0 if unstable) and use that to
set the initial conditions of a filter as follows:
  x(t<0)=x(0)
  y(t<0)=x(0) × dc_gain
This commit is contained in:
Laurence Withers 2011-04-15 17:37:22 +00:00
commit 9a87889dd3
3 changed files with 32 additions and 5 deletions

View file

@ -18,8 +18,10 @@ This leads to a general IIR filter equation:
<code>y(t) = x(t).c[0] + x(t-1).c[1] + … + x(t-N).c[N] - y(t-1).d[0] - y(t-2).d[1] - … - y(t-1-M).d[M]</code>
For initial conditions, the library sets <code>y(t)</code> for t &lt; 0 to 0,
and <code>x(t)</code> for t &lt; 0 to <code>x(0)</code>.
For initial conditions, the library sets <code>y(t)</code> for t &lt; 0 to
<code>x(0).G</code> (where <code>G</code> is the DC gain of the filter, or 0 if
it looks like the filter is unstable at DC), and <code>x(t)</code> for t &lt; 0
to <code>x(0)</code>.
*/