Convolution and digital filtration

Functions

int dspl_conv (double *a, int na, double *b, int nb, double *c)
Linear convolution for real input vectors. More...

int dspl_conv_cmplx (double *aR, double *aI, int na, double *bR, double *bI, int nb, double *cR, double *cI)
Linear convolution for real input vectors. More...

int dspl_filter_iir (double *b, double *a, int ord, double *x, int n, double *y)
IIR filter output for real filter coefficients and real signals. More...

Detailed Description

Functions for digital convolution and digital filtration.

◆ dspl_conv()

 int dspl_conv ( double * a, int na, double * b, int nb, double * c )

Linear convolution for real input vectors.

This function calculates a linear convolution of two real vectors.

Parameters
 [in] a First input vector pointer. Vector size is [na x 1]. [in] na First vector length. [in] b Second input vector pointer. Vector size is [nb x 1]. [in] nb Second vector length. [out] c Linear convolution vector real part pointer. Vector size is [na + nb - 1 x 1]. Memory must be allocated.
Returns
DSPL_OK if convolution is calculated successfully;

DSPL_ERROR_PTR if pointer are wrong.
This situation can be if a is NULL or b is NULL or c is NULL.

DSPL_ERROR_SIZE if na<1 or nb < 1.

◆ dspl_conv_cmplx()

 int dspl_conv_cmplx ( double * aR, double * aI, int na, double * bR, double * bI, int nb, double * cR, double * cI )

Linear convolution for real input vectors.

This function calculates a linear convolution of two real vectors $c = a * b$.

Parameters
 [in] aR First input vector real part pointer. Vector size is [na x 1]. [in] aI First input vector image part pointer. Vector size is [na x 1]. This pointer can be NULL if a is real vector [in] na First vector length. [in] bR Second input vector real part pointer. Vector size is [nb x 1]. [in] bI Second input vector image part pointer. Vector size is [nb x 1]. This pointer can be NULL if b is real vector. [in] nb Second vector length. [out] cR Linear convolution vector real part pointer. Vector size is [na + nb - 1 x 1]. Memory must be allocated. [out] cI Linear convolution vector real part pointer. Vector size is [na + nb - 1 x 1]. Memory must be allocated. This pointer can be NULL if aI and bI are NULL pointers.
Returns
DSPL_OK if convolution is calculated successfully

DSPL_ERROR_PTR if pointer are wrong. This situation can be if:
aR is NULL or bR is NULL or cR is NULL.
cI is NULL if aI or bI isn't NULL.

DSPL_ERROR_SIZE if na<1 or nb < 1.

◆ dspl_filter_iir()

 int dspl_filter_iir ( double * b, double * a, int ord, double * x, int n, double * y )

IIR filter output for real filter coefficients and real signals.

Function Calculates IIR filter output. IIR filter transfer function is

$H(z) = \frac{\sum_{n = 0}^{N-1} b_n \cdot z^{-n}} {1+{\frac{1}{a_0}}\sum_{m = 1}^{M-1} a_m \cdot z^{-n}},$

here $a_0$ cannot be zero, $N=M=$ord.

Parameters
 [in] b IIR filter transfer function numerator coefficients pointer. Vector size is [ord + 1 x 1]. [in] a IIR filter transfer function denominator coefficients pointer. Vector size is [ord + 1 x 1]. This pointer can be NULL. Filter becomes FIR in this case with impulse response corresponds to vector b [in] ord Filter order. [in] x Input signal pointer. Vector size is [n x 1]. [in] n Input signal vector length. [out] y IIR filter output vector pointer. Vector size is [n x 1]. Memory must be allocated.
Returns
DSPL_OK if filter output is calculated successfully.
DSPL_ERROR_PTR if pointer are wrong. This situation can be if: b is NULL or x is NULL or y is NULL.
DSPL_ERROR_SIZE if ord < 1 or n < 1.
DSPL_ERROR_FILTER_A0 if a[0] is zero.