kopia lustrzana https://github.com/Dsplib/libdspl-2.0
added doxygen for iir function
rodzic
159d414784
commit
55a0a07a6b
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 87 KiB Po Szerokość: | Wysokość: | Rozmiar: 87 KiB |
|
@ -1,7 +1,7 @@
|
|||
%!PS-Adobe-2.0
|
||||
%%Creator: dvips(k) 5.999 Copyright 2019 Radical Eye Software
|
||||
%%Title: _formulas.dvi
|
||||
%%CreationDate: Thu Jan 02 15:08:28 2020
|
||||
%%CreationDate: Thu Jan 09 19:59:42 2020
|
||||
%%Pages: 1
|
||||
%%PageOrder: Ascend
|
||||
%%BoundingBox: 0 0 612 792
|
||||
|
@ -12,7 +12,7 @@
|
|||
%DVIPSCommandLine: dvips -q -D 600 -n 1 -p 1 -o _form0_tmp.ps
|
||||
%+ _formulas.dvi
|
||||
%DVIPSParameters: dpi=600
|
||||
%DVIPSSource: TeX output 2020.01.02:1808
|
||||
%DVIPSSource: TeX output 2020.01.09:2259
|
||||
%%BeginProcSet: tex.pro 0 0
|
||||
%!
|
||||
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -1,4 +1,4 @@
|
|||
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/W32TeX) (preloaded format=latex 2019.12.29) 2 JAN 2020 18:08
|
||||
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/W32TeX) (preloaded format=latex 2019.12.29) 9 JAN 2020 22:59
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
%&-line parsing enabled.
|
||||
|
|
|
@ -82,11 +82,95 @@ err = 0
|
|||
|
||||
\image html bilinear.png
|
||||
|
||||
Скрипт GNUPLOT для построения графиков из текстовых файлов:
|
||||
\include bilinear_test.plt
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
***************************************************************************** */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! ****************************************************************************
|
||||
\ingroup IIR_FILTER_DESIGN_GROUP
|
||||
\fn int iir(double rp, double rs, int ord, double w0, double w1, int type, double* b, double* a)
|
||||
\brief Функция расчета коэффициентов передаточной характеристики \f$H(z)\f$
|
||||
цифрового фильтра БИХ.
|
||||
|
||||
Функция рассчитывает коэффициенты передаточной характеристики \f$H(z)\f$
|
||||
цифрового фильтра, которые могут быть использованы в функции \ref filter_iir
|
||||
|
||||
\param[in] rp Уровень неравномерности квадрата АЧХ
|
||||
в полосе пропускания фильтра (дБ).\n
|
||||
Размер вектора `[ord+1 x 1]`. \n \n
|
||||
|
||||
|
||||
\param[in] rs Уровень подавления
|
||||
в полосе заграждения фильтра (дБ).\n \n
|
||||
|
||||
\param[in] ord Порядок фильтра. \n
|
||||
Количество коэффициентов числителя и знаменателя
|
||||
передаточной функции \f$H(z)\f$
|
||||
цифрового фильтров равно `ord+1`. \n
|
||||
Для полосовых и режекторных фильтров параметр `ord`
|
||||
должен быть чётным.\n \n
|
||||
|
||||
\param[in] w0 Нормированная частота среза ФНЧ или ФВЧ, или
|
||||
левая частота среза для полосового и режекторного фильтра.\n \n
|
||||
|
||||
|
||||
\param[in] w1 Правая частота среза полосового и режекторного фильтра.\n
|
||||
Данный параметр игнорируется для ФНЧ и ФВЧ. \n \n
|
||||
|
||||
\param[in] type Тип фильтра. \n
|
||||
Данный параметр определяет тип фильтра и образуется
|
||||
набором флагов типа фильтра:\n
|
||||
\verbatim
|
||||
DSPL_FILTER_LPF - фильтр нижних частот;
|
||||
DSPL_FILTER_HPF - фильтр верхних частот;
|
||||
DSPL_FILTER_BPASS - полосовой фильтр;
|
||||
DSPL_FILTER_BSTOP - режекторный фильтр,
|
||||
\endverbatim
|
||||
а также флагов типа аппроксимации АЧХ фильтра:
|
||||
\verbatim
|
||||
DSPL_FILTER_BUTTER - фильтр Баттерворта;
|
||||
DSPL_FILTER_CHEBY1 - фильтр Чебышева первого рода;
|
||||
DSPL_FILTER_CHEBY2 - фильтр Чебышева второго рода;
|
||||
DSPL_FILTER_ELLIP - эллиптический фильтр.
|
||||
\endverbatim
|
||||
\n \n
|
||||
|
||||
\param[out] b Указатель на вектор коэффициентов
|
||||
числителя передаточной функции \f$H(z)\f$. \n
|
||||
Размер вектора `ord+1`.\n
|
||||
Память должна быть выделена. \n \n
|
||||
|
||||
\param[out] a Указатель на вектор коэффициентов
|
||||
знаменателя передаточной функции \f$H(z)\f$. \n
|
||||
Размер вектора `ord+1`.\n
|
||||
Память должна быть выделена. \n \n
|
||||
|
||||
\return
|
||||
`RES_OK` Фильтр рассчитан успешно. \n \n
|
||||
В противном случае \ref ERROR_CODE_GROUP "код ошибки". \n
|
||||
|
||||
<h3>Пример использования функции</h3>
|
||||
|
||||
\include iir_test.c
|
||||
|
||||
Данная программа производит расчет коэффициентов фильтров
|
||||
при различном сочетании флагов параметра `type`.
|
||||
|
||||
Кроме этого производится расчет АЧХ полученных цифровых фильтров и выводится на
|
||||
график АЧХ пакетом GNUPLOT
|
||||
|
||||
\image html iir_test.png
|
||||
|
||||
|
||||
\author
|
||||
Бахурин Сергей
|
||||
www.dsplib.org
|
||||
***************************************************************************** */
|
|
@ -87,9 +87,78 @@ int DSPL_API bilinear(double* bs, double* as, int ord, double* bz, double* az)
|
|||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Digital IIR filter coefficients calculation
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
/*! ****************************************************************************
|
||||
\ingroup IIR_FILTER_DESIGN_GROUP
|
||||
\fn int iir(double rp, double rs, int ord, double w0, double w1, int type, double* b, double* a)
|
||||
\brief IIR digital filter transfer function \f$H(z)\f$
|
||||
coefficients calculation which can be used in \ref filter_iir
|
||||
|
||||
|
||||
\param[in] rp Filter passband ripple level (dB). \n \n
|
||||
|
||||
\param[in] rs Filter stopband supression level (dB).\n \n
|
||||
|
||||
\param[in] ord Filter order. \n
|
||||
Number of \f$H(z)\f$ coefficients is `ord+1`. \n
|
||||
This parameter must be evan for bandpass
|
||||
and bandstop filter type.\n \n
|
||||
|
||||
\param[in] w0 Normlized cutoff frequency for LPF and HPF. \n
|
||||
Left cutoff frequency for bandpass and bandstop filter. \n
|
||||
Valid value from 0 to 1. \n
|
||||
Here 0 corresponds to 0 Hz frequency, 1 corresponds to
|
||||
Fs/2 Hz frequency. \n \n
|
||||
|
||||
|
||||
\param[in] w1 Right cutoff frequency for bandpass and bandstop filter.\n
|
||||
Valid value from 0 to 1. \n
|
||||
Here 0 corresponds to 0 Hz frequency, 1 corresponds to
|
||||
Fs/2 Hz frequency. \n
|
||||
This parameter is ignored for LPF and HPF. \n \n
|
||||
|
||||
\param[in] type Filter type. \n
|
||||
This paramenter is combination of filter type flags:\n
|
||||
\verbatim
|
||||
DSPL_FILTER_LPF - lowpass filter;
|
||||
DSPL_FILTER_HPF - highpass filter;
|
||||
DSPL_FILTER_BPASS - bandpass filter;
|
||||
DSPL_FILTER_BSTOP - bandstop filter,
|
||||
\endverbatim
|
||||
and filter approximation flags:
|
||||
\verbatim
|
||||
DSPL_FILTER_BUTTER - Buttetworth filter;
|
||||
DSPL_FILTER_CHEBY1 - Chebyshev type 1 filter;
|
||||
DSPL_FILTER_CHEBY2 - Chebyshev type 2 filter;
|
||||
DSPL_FILTER_ELLIP - elliptic filter.
|
||||
\endverbatim
|
||||
\n \n
|
||||
|
||||
\param[out] b Pointer to the vector of \f$H(z)\f$ numerator. \n
|
||||
Vector size is `[ord+1 x 1]`.\n
|
||||
Memory must be allocated. \n \n
|
||||
|
||||
\param[out] a Pointer to the vector of \f$H(z)\f$ denominator. \n
|
||||
Vector size is `[ord+1 x 1]`.\n
|
||||
Memory must be allocated. \n \n
|
||||
|
||||
\return
|
||||
`RES_OK` if filter is calculated successfully. \n \n
|
||||
Else \ref ERROR_CODE_GROUP "code error". \n
|
||||
|
||||
Example:
|
||||
|
||||
\include iir_test.c
|
||||
|
||||
Program calculates filter coefficients for different
|
||||
`type` parameter combination. Also program calculates filters magnitude and
|
||||
draws plot:
|
||||
|
||||
\image html iir_test.png
|
||||
|
||||
\author Sergey Bakhurin www.dsplib.org
|
||||
***************************************************************************** */
|
||||
int DSPL_API iir(double rp, double rs, int ord, double w0, double w1,
|
||||
int type, double* b, double* a)
|
||||
{
|
||||
|
@ -167,7 +236,6 @@ int DSPL_API iir(double rp, double rs, int ord, double w0, double w1,
|
|||
|
||||
err = bilinear(bt, at, ord, b, a);
|
||||
|
||||
|
||||
error_proc:
|
||||
|
||||
if(bs)
|
||||
|
|
Ładowanie…
Reference in New Issue