kopia lustrzana https://github.com/Dsplib/libdspl-2.0
205 wiersze
5.1 KiB
Plaintext
205 wiersze
5.1 KiB
Plaintext
/*! ****************************************************************************
|
|
\ingroup IIR_FILTER_DESIGN_GROUP
|
|
\fn int low2high (double* b, double* a, int ord, double w0, double w1,
|
|
double* beta, double* alpha)
|
|
\brief Lowpass to highpass filter frequency transform
|
|
|
|
Function transforms lowpass filter transfer function \f$ H(s) \f$
|
|
to the highpass filter transfer function \f$ F(s) \f$.
|
|
|
|
Filter order, magnitude ripple in passband and stopband
|
|
supression still the same.
|
|
|
|
\param[in] b
|
|
Pointer to the lowpass filter transfer function \f$H(s)\f$ numerator
|
|
coefficients vector. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] a
|
|
Pointer to the lowpass filter transfer function \f$H(s)\f$ denominator
|
|
coefficients vector. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] ord
|
|
Filter order. \n
|
|
\n
|
|
|
|
\param[in] w0
|
|
Lowpass filter cutoff frequency. \n
|
|
\n
|
|
|
|
\param[in] w1
|
|
Highpass filter cutoff frequency after transformation. \n
|
|
\n
|
|
|
|
\param[in,out] beta
|
|
Pointer to the highwpass filter transfer function \f$F(s)\f$ numerator
|
|
coefficients vector after transformation. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
\param[in,out] alpha
|
|
Pointer to the highwpass filter transfer function \f$F(s)\f$ denominator
|
|
coefficients vector after transformation. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
\return
|
|
`RES_OK` if filter coefficients is calculated successfully. \n
|
|
Else \ref ERROR_CODE_GROUP "code error".
|
|
|
|
\author Sergey Bakhurin www.dsplib.org
|
|
***************************************************************************** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! ****************************************************************************
|
|
\ingroup IIR_FILTER_DESIGN_GROUP
|
|
\fn int low2low(double* b, double* a, int ord, double w0, double w1,
|
|
double* beta, double* alpha)
|
|
|
|
Lowpass to lowpass filter frequency transform
|
|
|
|
Function transforms lowpass filter transfer function \f$ H(s) \f$
|
|
to the lowpass filter transfer function \f$ F(s) \f$
|
|
with other cutoff frequency.
|
|
|
|
Filter order, magnitude ripple in passband and stopband
|
|
supression still the same.
|
|
|
|
\param[in] b
|
|
Pointer to the input lowpass filter transfer function \f$H(s)\f$ numerator
|
|
coefficients vector. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] a
|
|
Pointer to the input lowpass filter transfer function \f$H(s)\f$ denominator
|
|
coefficients vector. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] ord
|
|
Filter order. \n
|
|
\n
|
|
|
|
\param[in] w0
|
|
Input lowpass filter cutoff frequency. \n
|
|
\n
|
|
|
|
\param[in] w1
|
|
Lowpass filter cutoff frequency after transformation. \n
|
|
\n
|
|
|
|
\param[in,out] beta
|
|
Pointer to the lowpass filter transfer function \f$F(s)\f$ numerator
|
|
coefficients vector after transformation. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
\param[in,out] alpha
|
|
Pointer to the lowpass filter transfer function \f$F(s)\f$ denominator
|
|
coefficients vector after transformation. \n
|
|
Vector size is `[ord+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
\return
|
|
`RES_OK` if filter coefficients is calculated successfully. \n
|
|
Else \ref ERROR_CODE_GROUP "code error".
|
|
|
|
\author Sergey Bakhurin www.dsplib.org
|
|
***************************************************************************** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! ****************************************************************************
|
|
\ingroup IIR_FILTER_DESIGN_GROUP
|
|
\fn int ratcompos( double* b, double* a, int n,
|
|
double* c, double* d, int p,
|
|
double* beta, double* alpha)
|
|
\brief Rational composition
|
|
|
|
Function calcultes composition \f$Y(s) = (H \circ F)(s) = H(F(s))\f$, here
|
|
|
|
\f[
|
|
H(s) = \frac{\sum\limits_{m = 0}^{n} b_m s^m}
|
|
{\sum\limits_{k = 0}^{n} a_k s^k}, \quad
|
|
F(s) = \frac{\sum\limits_{m = 0}^{p} d_m s^m}
|
|
{\sum\limits_{k = 0}^{p} c_k s^k}, \quad
|
|
Y(s) = \frac{\sum\limits_{m = 0}^{n p} \beta_m s^m}
|
|
{\sum\limits_{k = 0}^{n p} \alpha_k s^k}
|
|
\f]
|
|
|
|
This function is using for filter frequency transform.
|
|
|
|
\param[in] b
|
|
Pointer to the \f$H(s)\f$ polynomial function
|
|
numerator coefficients vector. \n
|
|
Vector size is `[n+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] a
|
|
Pointer to the \f$H(s)\f$ polynomial function
|
|
denominator coefficients vector. \n
|
|
Vector size is `[n+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] n
|
|
Order of \f$H(s)\f$ numerator and denominator polynomials. \n
|
|
\n
|
|
|
|
\param[in] c
|
|
Pointer to the \f$F(s)\f$ polynomial function
|
|
numerator coefficients vector. \n
|
|
Vector size is `[p+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] d
|
|
Pointer to the \f$F(s)\f$ polynomial function
|
|
denominator coefficients vector. \n
|
|
Vector size is `[p+1 x 1]`. \n
|
|
\n
|
|
|
|
\param[in] p
|
|
Order of \f$F(s)\f$ numerator and denominator polynomials. \n
|
|
\n
|
|
|
|
\param[in,out] beta
|
|
Pointer to the numerator coefficients vector of
|
|
\f$Y(s) = (H \circ F)(s)\f$. \n
|
|
Vector size is `[n*p+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
\param[in,out] alpha
|
|
Pointer to the denominator coefficients vector of
|
|
\f$Y(s) = (H \circ F)(s)\f$. \n
|
|
Vector size is `[n*p+1 x 1]`. \n
|
|
Memory must be allocated. \n
|
|
\n
|
|
|
|
|
|
\return
|
|
`RES_OK` if rational composition is calculated successfully. \n
|
|
Else \ref ERROR_CODE_GROUP "code error".
|
|
|
|
\author Sergey Bakhurin www.dsplib.org
|
|
***************************************************************************** */
|
|
|