9.2 Design of IIR Filters
IIR 滤波器设计
IIR 滤波器设计分两步:先基于技术指标设计一个模拟滤波器原型
,再把它转换成数字滤波器
。第二步有两种转换方法:脉冲响应不变法和双线性变换法。
两种方法各有取舍:脉冲响应不变法保持时域逼真,代价是混叠;双线性变换法彻底消除混叠,代价是频率畸变。
IIR design takes two steps: design an analog prototype H(s) from the specs, then convert it to a digital
filter H(z). The second step has two methods with different trade-offs: pulse invariance keeps the
time-domain response faithful but aliases; the bilinear transform removes aliasing at the cost of frequency warping.
设计之前先写清要什么。低通的完整规格就是四项:通带边 、 通带最大衰减 、阻带边 、 阻带最小衰减 。它们在幅频图(dB)上钉出两块禁区:通带内曲线不得低于 ,阻带内不得高于 。 中间留出的缝隙,就是后面要让滤波器响应穿过的"指标矩形"。
Butterworth 低通的幅度平方函数 , 在通带内最大平坦。阶数 越高滚降越陡; 个极点在 平面上沿半径 的左半圆均匀分布。 拿 Step 0 钉出的指标矩形当靶子,在 Butterworth 处方下调 、, 让右图的幅频曲线穿过缝隙即达标(绿色)。
给定技术指标,如何一步步设计 Butterworth 模拟原型?Designing the Butterworth prototype from specs, step by step
例:通带截止 、通带最大衰减 、阻带截止 、阻带最小衰减 。
| 指标 | ||||
|---|---|---|---|---|
| 取值 | 5 kHz | 2 dB | 12 kHz | 30 dB |
指标计算器(输入四个指标,自动算 并检验)
Worked example: solve the two attenuation equations, divide to get N (round up), anchor ωc on ωp, verify the stopband. Then read the normalized prototype Ha(p) from a table (or from poles) and de-normalize via p = s/ωc to get Ha(s).
频带转换:一个低通原型怎样覆盖高通、带通、带阻?Frequency transformations: one low-pass prototype covers HP, BP, and BS
我们只设计一种东西:归一化低通原型 。高通、带通、带阻都不必重新设计,只要对频率变量做一次代换,把目标滤波器的指标先"翻译"成一个等价的低通问题,求出 和 后,再代换回去得到 。
技术指标→ 归一化及
频带转换→ 归一化原型
低通指标
→ 求 → →
| 类型 | 频率代换 | 还原 |
|---|---|---|
| 低通 | ||
| 高通 | (指标取倒数) | |
| 带通 | ||
| 带阻 |
带通、带阻多一步几何归一化:带宽 ,中心频率 ,再以 归一化各边界()。阻带两侧不对称时,取 较小的一侧作为设计依据,以保证两边都满足指标。
带通设计完整算例(Butterworth)Worked example: a Butterworth band-pass filter
例:中心频率 ,带宽 (通带 ),最大衰减 ;阻带频率 ,最小衰减 。
Normalize to an equivalent low-pass spec (λp=1, λs=5.3077), design a 3rd-order Butterworth H(p), then de-normalize via p=(s²+ω0²)/(sB). Two common slips: the prototype's constant +1 folds into the s³ term (400+1=401), and the constant term is (ω0²)³=10⁶ with no spurious +1.
You design only the normalized low-pass prototype H(p). HP/BP/BS need no redesign: substitute the frequency variable (λ in terms of η) to translate the target spec into an equivalent low-pass problem, solve for N and ωc, then substitute back to get H(s). BP/BS add a geometric normalization with bandwidth B and center ω0.
思路是让冲激响应不变:对模拟原型的 按周期 采样得到 ,极点映射 。 频率映射是线性的 ,但时域采样会让模拟频谱周期延拓, 相邻副本在折叠频率 附近交叠,这就是混叠。 拖动 ,看折叠频率怎样切进模拟响应。
算例:把 用脉冲响应不变法转成 Worked example: convert this two-pole H(s) by pulse invariance
Expand H(s) into partial fractions, map each pole s=−pᵢ to z=e^{−pᵢT}, and sum the sampled terms. T=0.01 leaves ample margin (folding freq π/T ≫ the −40 dB point ω≈24.3); T=1 aliases badly. Same H(s) is converted by the bilinear method below for comparison.
核心是非线性压缩:用 把整条模拟频率轴 单值地压进数字频段 ,映射关系 。 好处是无混叠,能设计四类原型;代价是 与 非线性,频率会畸变。 靠预畸(pre-warp)反向修正,使指定的数字截止精确落位(此处取 )。
算例:同一个 改用双线性变换Worked example: the same H(s), converted by the bilinear transform
用上面脉冲响应不变法同一个模拟原型,换双线性变换,便于直接对比两种桥梁。
Both methods give nonlinear-phase IIR filters (linear phase is FIR-only). What differs is the frequency mapping. Group delay scales by the map's slope dω/dΩ: linear (Ω=ωT) keeps the shape (slope 1/T constant); bilinear has slope (1/T)·sec²(Ω/2), which diverges near Nyquist (Ω→π). The plot shows the same H_a under both mappings: they coincide at low frequency and split toward Nyquist, where the bilinear group delay shoots up. That delay distortion near Nyquist is the price the bilinear transform pays for being alias-free, mirroring how pulse invariance keeps the delay shape but suffers aliasing.
两种方法都把模拟 平面映到数字 平面, 也都把左半平面映进单位圆(同样保稳定)。真正的分水岭只有一条:映射是否一一对应。 把无限长的 轴塞进周长有限的单位圆,鱼和熊掌不可兼得: 要么保持线性(),那只能装下一段,其余卷绕重叠成混叠; 要么保持一一对应(双线性),那就必须把无限长非线性压缩进来,造成频率畸变。
| 方法一 脉冲响应不变 | 方法二 双线性变换 | |
|---|---|---|
| 关系 | ||
| 映射类型 | 超越(指数) | 有理(Möbius 分式线性) |
| 是否一一对应 | 多对一(每条高 的横带各绕一圈) | 一一对应(整面共形双射) |
| 轴映到 | 单位圆,无限次卷绕 | 单位圆,恰好一次 |
| 左半平面映到 | 圆内(稳定保持) | 圆内(稳定保持) |
| 频率关系 | (线性,单带内单值) | (非线性 warping) |
| 直接后果 | 混叠 | 无混叠,但频率畸变 |
两个常被忽略的精确细节Two precise details worth nailing down
1. 脉冲响应不变法里只有极点按 映,零点不按。 数字零点是部分分式求和后产生的,与模拟零点无对应关系。双线性则是极点、零点全部随代换走(还在 处多出零点,对应 )。
2. 为什么脉冲响应不变法必须先做部分分式,双线性却能整体代入? 因为 是超越映射,直接代入 得不到有理函数;只有拆成单极点,每个 才能干净地映成 。双线性是有理代换,保持有理结构,所以可一步整体代入。
In pulse invariance only the poles follow z = e^{pT}; the zeros come from the partial-fraction sum and bear no relation to the analog zeros. The map z = e^{sT} is transcendental, so it must be applied pole by pole; the bilinear map is rational and preserves the rational structure, so it can be substituted whole.
Q1: 为什么脉冲响应不变法会混叠,双线性变换法却不会?Why does pulse invariance alias while the bilinear transform does not?
差别在频率映射的"量程"。脉冲响应不变法本质是对 采样,频率映射 是线性的,但只能容纳一个折叠周期 。 模拟原型在 以上还没衰减干净的那部分能量,采样后被折叠回基带,叠加在真实响应上。
双线性变换法用 把整条无限长的模拟频率轴一对一压进 。每个数字频率只对应唯一一个模拟频率,没有多个频率挤到同一处,所以不会混叠。
Pulse invariance samples h(t): its linear map holds only one folding period, so the analog tail above π/T folds back (aliasing). The bilinear map squeezes the whole infinite analog axis one-to-one into (−π, π), so nothing overlaps.
Q2: 预畸到底"畸"的是谁?为什么要在设计前先把指标改掉?What exactly does pre-warping warp, and why do it before designing?
畸变来自映射 的非线性:除了 附近, 数字频率总比"线性预期"低。如果直接拿目标数字截止 当模拟截止去设计(即令 ), 变换后真实的数字截止会偏到 (本页取 ),位置不对。
预畸是反向操作:先把模拟原型的截止改到 , 这样经双线性压缩后正好落回 。畸的是模拟原型的设计指标, 为的是让最终数字滤波器的关键频点准确。打开和关闭右上方的预畸开关,对比橙线(目标)和绿/红曲线的截止位置就一目了然。
The warp is the nonlinearity of Ω = 2·arctan(ωT/2): digital frequencies come out lower than the linear guess. Pre-warping pushes the analog design spec out to ωc' = (2/T)·tan(Ωc/2) in advance, so after the bilinear squeeze the digital cutoff lands exactly on Ωc.
Q3: 为什么脉冲响应不变法只适合低通、带通,不适合高通、带阻?Why is pulse invariance only suitable for LP/BP, not HP/BS?
能不能用,取决于模拟原型在折叠频率 以上还剩多少能量。低通、带通在高频是衰减的, 只要 留足余量,落进来的副本能量很小,混叠可以接受。
高通、带阻在高频放行,模拟响应到无穷远都不衰减,副本能量大,无论怎么提高采样率都会严重混叠,因此脉冲响应不变法对它们失效。 这种情形要用双线性变换法(无混叠)。
It hinges on how much energy survives above π/T. LP/BP roll off at high frequency, so with enough margin the folded replicas are negligible. HP/BS pass high frequencies forever, so replicas are large and aliasing is unavoidable. Use the bilinear transform there.
Q4: 折叠频率 的"留余量"到底留多少?How much margin should the folding frequency π/T leave?
经验上让模拟原型在 处的衰减达到设计阻带衰减 (常见 dB)以上, 混叠就压到指标以下。课本两极点例子 的 dB 点约在 ,于是要求 ,即 。
本页拖动 时,下方读数会算出折叠频率处的衰减和余量判断:余量充足时灰虚(理想)和红线几乎重合;余量不足时红线在阻带明显抬起,那就是混叠。提高阶数 让模拟原型滚降更陡,也能改善余量。
Rule of thumb: make the analog prototype's attenuation at π/T meet the stopband spec αs (often 40–60 dB). For the textbook two-pole example, the −40 dB point is near ω ≈ 24.3, so π/T > 24.3, i.e. T < 0.13. Higher order N steepens the rolloff and helps the margin.