C++ interface for Infinite Impulse Response. More...

array iir (int nb, const float *h_b, int na, const float *h_a, const array &x)
 
array iir (const array &b, const array &a, const array &x)
 

Detailed Description

C++ interface for Infinite Impulse Response.

Apply an infinite impulse response filter (transposed Direct Form II implementation).

If a is scalar this defaults to the faster Finite Impulse Response, i.e. fir. The IIR is defined as:

\[ a_0*y_{n-1} = b_0*x_{n-1} + b_1*x_{n-2} + \ldots + b_{nb-1}*x_{n-nb-1} - a_1*y_{n-2} - \ldots - a_{na-1}*y_{n-na-1} \]

array a = seq(1, 8);
a = a / 10.0f;
print(a);
// a = 0.1000
// 0.2000
// 0.3000
// 0.4000
// 0.5000
// 0.6000
// 0.7000
// 0.8000
array b = seq(1, 8);
print(b);
// b = 1.0000
// 2.0000
// 3.0000
// 4.0000
// 5.0000
// 6.0000
// 7.0000
// 8.0000
array x = randn(8, 1);
array f = iir(b, a, x);
print(f);
// f = 2.9254
// -7.1836
// 1.0000
// -3.9320
// 25.4702
// -0.0344
// 0.0829
// -2.5098

Function Documentation

array af::iir ( int  nb,
const float *  h_b,
int  na,
const float *  h_a,
const array &  x 
)
Parameters
[in]nblength of h_b
[in]h_bhost-vector feedforward filter coefficients
[in]nalength of h_a
[in]h_ahost-vector feedback filter coefficients
[in]x
Returns
filtered signal (y) same size as x
array af::iir ( const array &  b,
const array &  a,
const array &  x 
)
Parameters
[in]bfeedforward filter coefficients
[in]afeedback filter coefficients
[in]x
Returns
filtered signal (y) same size as x