当前位置:   article > 正文

巴特沃斯滤波器 python_IIR数字滤波器设计

python 0相位滤波 demo

数字滤波器指标

给定滤波器的幅度响应和相位响应,设计滤波器。可实现的传输函数能够逼近这些指标,逼近的要求是在通带内,幅度满足

equation?tex=1-%5Cdelta_p+%5Cle+%7CG%28e%5E%7Bi%5Comega%7D%29%7C+%5Cle+1%2B%5Cdelta_p

在阻带内

equation?tex=%7CG%28e%5E%7Bi%5Comega%7D%29%7C+%5Cle+%5Cdelta_s

在边界点的频率

equation?tex=%5Comega_p
equation?tex=%5Comega_s分别称为
通带边界频率阻带边界频率
equation?tex=%5Cdelta_p
equation?tex=%5Cdelta_s分别称为
通带和阻带的误差容限,也叫 波纹峰值

大多数情况下传输函数

equation?tex=G%28z%29是实函数,因此幅度响应
equation?tex=A%28%5Comega%29是偶函数。因此只需要在
equation?tex=%5B0%2C+%5Cpi%29范围内确定滤波器的指标。

把前面定义的波纹峰值取对数,得到的量定义为峰值通带波纹

equation?tex=%5Calpha_p
最小阻带衰减
equation?tex=%5Calpha_s

equation?tex=%5Calpha_p+%3D+-20%5Clg%281-%5Cdelta_p%29

equation?tex=%5Calpha_s+%3D+-20%5Clg%5Cdelta_s

通过归一化,可以定义最大通带幅度偏离是通带幅度的最小值,记为

equation?tex=%5Cfrac%7B1-+%5Cdelta_p%7D%7B1%2B%5Cdelta_p%7D+%3D+%5Cfrac%7B1%7D%7B%5Csqrt%7B1%2B%5Cepsilon%5E2%7D%7D

最大阻带幅度记为

equation?tex=%5Cdelta_s+%3D+%5Cfrac+1A

最大通带衰减为峰值通带波纹

equation?tex=%5Calpha_%7Bmax%7D+%3D+20%5Clg%28%5Csqrt%7B1%2B%5Cepsilon%5E2%7D%29

容易证明,

equation?tex=%5Calpha_%7Bmax%7D+%5Csim+2%5Calpha_p+%5C%2C%28%5Cdelta_p+%5Crightarrow+0%29

选择滤波器类型

设计IIR滤波器时,传输函数是实有理函数

equation?tex=H%28z%29+%3D+%5Cfrac%7Bp_0%2B...%2Bp_Mz%5E%7B-M%7D%7D%7Bd_0+%2B...%2Bd_Nz%5E%7B-N%7D%7D

为了降低计算复杂度,

equation?tex=N越小越好。

将数字滤波器的设计指标转化成模拟低通滤波器的设计指标,从而确定满足指标的模拟低通滤波器的传输函数,然后再将它变成数字滤波器的传输函数。

将模拟传输函数

equation?tex=H%28s%29变换为数字IIR传输函数
equation?tex=G%28z%29的方法是构造映射使s平面映射到z平面,而且满足
  1. s平面的虚轴映射到z平面的单位圆;
  2. 稳定的模拟传输函数能转换为稳定的数字传输函数,即左半平面的极点映射到单位圆内。

共形映射

equation?tex=f%28z%29+%3D+%5Cfrac+2T+%5Cfrac%7B1-z%5E%7B-1%7D%7D%7B1%2Bz%5E%7B-1%7D%7D

equation?tex=f%3A+Z%5Crightarrow+S

equation?tex=z平面映射到s平面且能够保持上面两条性质。

equation?tex=s平面上的虚轴在映射下

模拟滤波器的设计

巴特沃斯逼近

模拟滤波器也定义了峰值通带波纹最小阻带衰减,归一化后,通带波纹和最大阻带波纹与数字滤波器定义一致。

定义过渡比为通带边界频率和阻带边界频率之比

equation?tex=k%3D%5Cfrac%7B%5COmega_p%7D%7B%5COmega_s%7D

定义分辨参数

equation?tex=k_1+%3D+%5Cfrac%7B%5Cepsilon%7D%7B%5Csqrt%7BA%5E2+-+1%7D%7D+%5Cll+1

一个

equation?tex=N阶模拟低通巴特沃斯滤波器
equation?tex=H%28s%29的幅度平方响应为

equation?tex=%7CH%28i%5COmega%29%7C%5E2+%3D+%5Cfrac%7B1%7D%7B1%2B%5Cleft%28%5Cfrac%7B%5COmega%7D%7B%5COmega_c%7D%5Cright%29%5E%7B2N%7D%7D

equation?tex=%5COmega_c称为3dB截止频率。

根据通带波纹和最大阻带波纹的定义得到

equation?tex=%7CH%28i%5COmega_p%29%7C%5E2%3D%5Cfrac%7B1%7D%7B1%2B%5Cleft%28%5Cfrac%7B%5COmega_p%7D%7B%5COmega_c%7D%5Cright%29%5E%7B2N%7D%7D%3D%5Cfrac%7B1%7D%7B1%2B%5Cepsilon%5E2%7D

equation?tex=%7CH%28i%5COmega_s%29%7C%5E2%3D%5Cfrac%7B1%7D%7B1%2B%5Cleft%28%5Cfrac%7B%5COmega_s%7D%7B%5COmega_c%7D%5Cright%29%5E%7B2N%7D%7D%3D%5Cfrac%7B1%7D%7BA%5E2%7D

滤波器阶数

equation?tex=N的估计式为

equation?tex=N+%3D+%5Cfrac%7B%5Clg+k_1%7D%7B%5Clg+k%7D

巴特沃斯低通滤波器的传输函数表达式为

equation?tex=H_a%28s%29+%3D+%5Cfrac%7B%5COmega_c%5EN%7D%7B%5Cprod_%7Bk+%3D+1%7D%5EN+%28s-p_k%29%7D

其中

equation?tex=p_k+%3D+%5COmega_c+e%5E%7Bi%5Cpi+%5Cfrac%7BN%2B2k-1%7D%7B2N%7D%7D

分母是巴特沃斯多项式,可以查表。

切比雪夫逼近

切比雪夫1型逼近幅度特性在通带内等波纹,在阻带内单调。

equation?tex=N阶模拟低通切比雪夫1型滤波器的幅度响应为

equation?tex=%7CH_a%28i%5COmega%29%7C%5E2+%3D+%5Cfrac%7B1%7D%7B1+%2B%5Cepsilon%5E2+T%5E2_n%5Cleft%28%5Cfrac%7B%5COmega%7D%7B%5COmega_P%7D%5Cright%29%7D

equation?tex=T_N%28%5COmega%29
equation?tex=N阶切比雪夫多项式。

不同阶数的幅度响应在

equation?tex=%5B0%2C1%29等波纹,在
equation?tex=%281%2C+%5Cpi%29单调下降。

传输函数的阶数通过阻带中在一个特定频率上的衰减指标来确定。

equation?tex=N+%3D+%5Cfrac%7Barccosh%28%5Cfrac%7B1%7D%7Bk_1%7D%29%7D%7Barccosh%28%5Cfrac%7B1%7D%7Bk%7D%29%7D

传输函数用极点形式表示为

equation?tex=H_a%28s%29+%3D+%5Cfrac%7B%5COmega_c%5EN%7D%7B%5Cprod_%7Bk+%3D+1%7D%5EN+%28s-p_k%29%7D

其中

equation?tex=p_k%3D-%5COmega_p+%5Cfrac%7B%5Cgamma%5E2-1%7D%7B2%5Cgamma%7D%5Csin%5Cfrac%7B%282k-1%29%5Cpi%7D%7B2N%7D%2Bi%5COmega_p%5Cfrac%7B%5Cgamma%5E2%2B1%7D%7B2%5Cgamma%7D%5Ccos%5Cfrac%7B%282k-1%29%5Cpi%7D%7B2N%7D

equation?tex=%5Cgamma%3D+%5Csqrt%5Bn%5D%7B%5Cfrac%7B1%2B%5Csqrt%7B1%2B%5Cepsilon%5E2%7D%7D%7B%5Cepsilon%7D%7D

切比雪夫2型逼近的幅度响应在通带内单调,在阻带内等波纹。表达式为

equation?tex=%7CH_a%28i%5COmega%29%7C%5E2+%3D%5Cfrac%7B1%7D%7B1%2B%5Cepsilon%5E2%5Cleft%28%5Cfrac%7BT_N%28%5Cfrac%7B%5COmega_s%7D%7B%5COmega_p%7D%29%7D%7BT_N%28%5Cfrac%7B%5COmega_s%7D%7B%5COmega%7D%29%7D%5Cright%29%5E2%7D

它既有零点又有极点,

equation?tex=H_a%28s%29+%3D+C_0%5Cfrac%7B%5Cprod_%7Bk+%3D+1%7D%5EN+%28s-z_k%29%7D%7B%5Cprod_%7Bk+%3D+1%7D%5EN+%28s-p_k%29%7D

其中

equation?tex=z_k%3D%5Cfrac%7Bi%5COmega_s%7D%7B%5Ccos%5Cfrac%7B%282k-1%29%5Cpi%7D%7B2N%7D%7D

椭圆逼近

椭圆低通滤波器的平方幅度响应为

equation?tex=%7CH_a%28i%5COmega%29%7C%5E2%3D%5Cfrac%7B1%7D%7B1%2B%5Cepsilon%5E2R_N%5E2%28%5Cfrac%7B%5COmega%7D%7B%5COmega_p%7D%29%7D

其中

equation?tex=R_N%28x%29满足

equation?tex=R_N%5Cleft%28%5Cfrac%7B1%7D%7Bx%7D%5Cright%29+%3D+%5Cfrac%7B1%7D%7BR_N%28x%29%7D

分子的根在

equation?tex=%280%2C1%29,分母的根在
equation?tex=%281%2C%2B%5Cinfty%29

滤波器的阶数估计为

equation?tex=N%3D%5Cfrac%7B2%5Clg%28%5Cfrac%7B4%7D%7Bk_1%7D%29%7D%7B%5Clg%28%5Cfrac+1+%5Crho%29%7D

其中

equation?tex=%5Crho_0+%3D+%5Cfrac%7B1-%5Csqrt%7Bk%27%7D%7D%7B2%281%2B%5Csqrt%7Bk%27%7D%29%7D+%5Cquad+k%27%3D%5Csqrt%7B1-k%5E2%7D

equation?tex=%5Crho+%3D+%5Crho_0%2B2%5Crho_0%5E5%2B15%5Crho_0%5E9%2B150%5Crho_0%5E%7B13%7D

设计低阶数字滤波器

一阶巴特沃斯低通数字滤波器

3dB截止频率为

equation?tex=%5Comega_c的一阶巴特沃斯低通模拟滤波器的传输函数为

equation?tex=H_%7BLP%7D%28s%29+%3D+%5Cfrac%7B%5Comega_c%7D%7B%5Comega_c+%2B+s%7D

根据前面的结果将z变换为s的映射为

equation?tex=s%3D+%5Cfrac+2T+%5Cfrac%7B1-z%5E%7B-1%7D%7D%7B1%2Bz%5E%7B-1%7D%7D

带入后得到

equation?tex=G_%7BLP%7D%28z%29+%3D+%5Cfrac%7B1-%5Calpha%7D%7B2%7D%5Cfrac%7B1%2Bz%5E%7B-1%7D%7D%7B1-%5Calpha+z%5E%7B-1%7D%7D

其中

equation?tex=%5Calpha+%3D+%5Cfrac%7B1-%5Cfrac%7B%5Comega_c+T%7D%7B2%7D%7D%7B1%2B%5Cfrac%7B%5Comega_cT%7D%7B2%7D%7D

一阶巴特沃斯高通数字滤波器

为了得到截止频率为

equation?tex=%5Comega_c的巴特沃斯高通滤波器,对
equation?tex=s进行反演变换

equation?tex=f%28z%29+%3D+%5Cfrac%7B%5Comega_c+%5E2%7D%7Bz%7D

equation?tex=f%3A+S%5Crightarrow+S

得到巴特沃斯高通模拟滤波器的传输函数为

equation?tex=H_%7BHP%7D%28s%29%3D%5Cfrac%7Bs%7D%7Bs%2B%5Comega_c%7D

巴特沃斯高通数字滤波器的传输函数为

equation?tex=G_%7BHP%7D%28z%29+%3D+%5Cfrac%7B1%2B%5Calpha%7D%7B2%7D%5Cfrac%7B1-z%5E%7B-1%7D%7D%7B1-%5Calpha+z%5E%7B-1%7D%7D

二阶带通数字滤波器

定理:通带边界频率为
equation?tex=%5COmega_p的模拟低通传输函数
equation?tex=H_%7BLP%7D%28s%29在变换
equation?tex=f%28z%29+%3D+%5COmega_p+%5Cfrac%7Bz%5E2%2B%5COmega_o%5E2%7D%7Bz%28%5COmega_%7Bp2%7D-%5COmega_%7Bp1%7D%29%7D
equation?tex=f%3A+S%5Crightarrow+S

下变成边界频率为
equation?tex=%5COmega_%7Bp1%7D
equation?tex=%5COmega_%7Bp2%7D的模拟带通传输函数
equation?tex=H_%7BBP%7D%28s%29

频率0映射到频率
equation?tex=%5COmega_0,为带通滤波器的通带中心频率。

对一阶巴特沃斯低通滤波器进行变换得到二阶模拟带通滤波器的传输函数为

equation?tex=H_%7BBP%7D%28s%29+%3D+%5Cfrac%7BBs%7D%7Bs%5E2%2BBs%2B%5COmega_0%5E2%7D

在变换到

equation?tex=z平面得到

equation?tex=G_%7BBP%7D%28z%29+%3D+%5Cfrac%7B1-%5Calpha%7D%7B2%7D%5Cfrac%7B1-z%5E%7B-2%7D%7D%7B1-%5Cbeta%281%2B%5Calpha%29z%5E%7B-1%7D%2B%5Calpha+z%5E%7B-2%7D%7D

其中

equation?tex=%5Calpha+%3D+%5Cfrac%7B1-%5Cfrac%7BBT%7D%7B2%7D%2B%5Cfrac%7BT%5E2%5COmega_0%5E2%7D%7B4%7D%7D%7B1%2B%5Cfrac%7BBT%7D%7B2%7D%2B%5Cfrac%7BT%5E2%5COmega_0%5E2%7D%7B4%7D%7D

equation?tex=%5Cbeta+%3D%5Cfrac%7B1-%5Cfrac%7BT%5E2%5COmega_0%5E2%7D%7B4%7D%7D%7B1%2B%5Cfrac%7BT%5E2%5COmega_0%5E2%7D%7B4%7D%7D

二阶带阻数字滤波器

对模拟带通滤波器的传输函数使用反演变换

equation?tex=f%28z%29+%3D+%5Cfrac%7B%5COmega_0%5E2%7D%7Bz%7D

将通带中心频率

equation?tex=%5COmega_0变换为阻带中心频率点。传输函数为

equation?tex=H_%7BBS%7D%28s%29+%3D+%5Cfrac%7Bs%5E2%2B%5COmega_0%5E2%7D%7Bs%5E2%2BBs%2B%5COmega_0%5E2%7D

变换到

equation?tex=z平面的结果为

equation?tex=G_%7BBP%7D%28z%29+%3D+%5Cfrac%7B1-%5Calpha%7D%7B2%7D%5Cfrac%7B1-2%5Cbeta+z%5E%7B-1%7D%2Bz%5E%7B-2%7D%7D%7B1-%5Cbeta%281%2B%5Calpha%29z%5E%7B-1%7D%2B%5Calpha+z%5E%7B-2%7D%7D

equation?tex=%5Calpha
equation?tex=%5Cbeta的表达式和前面相同。

设计低通IIR数字滤波器

  1. 对数字滤波器指标进行变换,得到对应的模拟滤波器原型的指标;
  2. 设计出模拟传输函数
    equation?tex=H%28s%29
  3. 进行变换得到数字传输函数
    equation?tex=G%28z%29

变换参数

equation?tex=T
equation?tex=G%28z%29无影响,取
equation?tex=T%3D2,变换为

equation?tex=f%28z%29+%3D+%5Cfrac%7B1%2Bz%7D%7B1-z%7D

equation?tex=f%3A+S+%5Crightarrow+Z

equation?tex=s平面的虚轴映射到
equation?tex=z平面的单位圆,因此

equation?tex=%5COmega+%3D+%5Ctan%5Cleft%28%5Cfrac%7B%5Comega%7D%7B2%7D%5Cright%29

设计满足下面条件的滤波器:通带边界频率为

equation?tex=%5Comega_p+%3D+0.25%5Cpi,通带波纹不超过0.5dB,在阻带边界频率
equation?tex=%5Comega_s%3D0.55%5Cpi的最小阻带衰减为15dB。

这要求

equation?tex=-20%5Clg%7CG_%7BLP%7D%28e%5E%7B0.25%5Cpi+i%7D%29%7C+%5Cle+0.5

equation?tex=-20%5Clg%7CG_%7BLP%7D%28e%5E%7B0.55%5Cpi+i%7D%29%7C+%5Cge+15

对应于数字边界频率的模拟边界频率为

equation?tex=%5COmega_p%3D%5Ctan%5Cleft%28%5Cfrac%7B%5Comega_p%7D%7B2%7D%5Cright%29+%3D+0.414

equation?tex=%5COmega_s%3D%5Ctan%5Cleft%28%5Cfrac%7B%5Comega_s%7D%7B2%7D%5Cright%29+%3D+1.171

计算得

equation?tex=%5Cfrac%7B1%7D%7Bk%7D+%3D+2.827

equation?tex=%5Cfrac%7B1%7D%7Bk_1%7D+%3D+15.842

估算滤波器的阶数为

equation?tex=N+%3D+2.659

因此滤波器的阶数取为3。

根据下面的式子

equation?tex=%7CH%28i%5COmega_p%29%7C%5E2%3D%5Cfrac%7B1%7D%7B1%2B%5Cleft%28%5Cfrac%7B%5COmega_p%7D%7B%5COmega_c%7D%5Cright%29%5E%7B2N%7D%7D%3D%5Cfrac%7B1%7D%7B1%2B%5Cepsilon%5E2%7D

equation?tex=%7CH%28i%5COmega_s%29%7C%5E2%3D%5Cfrac%7B1%7D%7B1%2B%5Cleft%28%5Cfrac%7B%5COmega_s%7D%7B%5COmega_c%7D%5Cright%29%5E%7B2N%7D%7D%3D%5Cfrac%7B1%7D%7BA%5E2%7D

求出

equation?tex=%5COmega_c+%3D+0.588

使用MATLAB函数buttap得到三阶归一化低通巴特沃斯传输函数为

equation?tex=H_%7Ban%7D%28s%29+%3D+%5Cfrac%7B1%7D%7B%28s%2B1%29%28s%5E2%2Bs%2B1%29%7D

这个函数计算出的3dB频率为

equation?tex=%5COmega+%3D+1,因此要进行归一化,得到的传输函数为

equation?tex=H_a%28s%29+%3D+H_%7Ban%7D%5Cleft%28%5Cfrac%7Bs%7D%7B0.588%7D%5Cright%29%3D%5Cfrac%7B0.203%7D%7B%28s%2B0.588%29%28s%5E2%2B0.588s%2B0.346%29%7D

再变换到

equation?tex=z平面得到数字低通传输函数的表达式为

equation?tex=G_%7BLP%7D%28z%29%3D%5Cfrac%7B0.066%281%2Bz%5E%7B-1%7D%29%5E3%7D%7B%281-0.259z%5E%7B-1%7D%29%281-0.676z%5E%7B-1%7D%2B0.391z%5E%7B-2%7D%29%7D
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/78301
推荐阅读
相关标签
  

闽ICP备14008679号