Outline大綱アウトライン
14.1 Least Integral-Squared Error14.1 最小積分平方誤差14.1 最小積分二乗誤差
14.2 Approximating Ideal Filters14.2 逼近理想濾波器14.2 理想フィルタの近似
14.3 Gibbs Phenomenon14.3 Gibbs 現象14.3 ギブス現象
14.4 Window Shapes14.4 視窗形狀14.4 窓の形状
14.5 Windowed Design in Practice14.5 視窗法的實務設計14.5 実務における窓関数法設計
14.6 Iterative Optimization; FIR vs IIR14.6 疊代最佳化;FIR 與 IIR14.6 反復最適化;FIR と IIR
14.7 Summary14.7 總結14.7 まとめ
Exercises習題演習問題
DSP Study Guide · Chapter 14DSP 學習指南 · 第 14 章DSP 学習ガイド · 第 14 章

FIR Filter DesignFIR 濾波器設計FIR フィルタ設計

Designing finite impulse response filters by windowing the ideal impulse response — least-squares truncation, the Gibbs phenomenon, window trade-offs, the Kaiser window, and a look at equiripple optimization.對理想脈衝響應加窗,來設計有限脈衝響應濾波器——最小平方截斷、Gibbs 現象、視窗之間的取捨、Kaiser 視窗,以及等漣波最佳化的一瞥。理想インパルス応答に窓をかけて有限インパルス応答フィルタを設計する —— 最小二乗打ち切り、ギブス現象、窓のトレードオフ、カイザー窓、そして等リップル最適化の概観。

14.1 Least Integral-Squared Error Design14.1 最小積分平方誤差設計14.1 最小積分二乗誤差による設計

Chapter 13 designed IIR filters by transforming analog prototypes. This chapter designs FIR filters(有限脈衝響應濾波器) directly in discrete time. The simplest idea: start from a desired (usually ideal) frequency response $H_d(e^{j\omega})$ and find the best finite-length impulse response $h_t[n]$ that approximates it.第 13 章是把類比原型做轉換來設計 IIR 濾波器。本章則直接在離散時間裡設計 FIR 濾波器(有限脈衝響應濾波器)。最簡單的想法是:從一個想要的(通常是理想的)頻率響應 $H_d(e^{j\omega})$ 出發,找出能逼近它的最佳有限長度脈衝響應 $h_t[n]$。第 13 章ではアナログプロトタイプを変換して IIR フィルタを設計した。本章では離散時間で直接 FIR フィルタ(有限インパルス応答フィルタ)を設計する。もっとも素朴な発想はこうである:望みの(たいていは理想の)周波数応答 $H_d(e^{j\omega})$ から出発し、それを近似する最良の有限長インパルス応答 $h_t[n]$ を見つける。

14.1.1 “Best” in what sense?14.1.1 哪一種意義下的「最佳」?14.1.1 どういう意味で「最良」か

“Best” needs a criterion. The natural first choice is to minimize the Integral Squared Error(積分平方誤差,ISE) between the desired and the actual frequency responses:「最佳」需要一個準則。最自然的第一個選擇,是把想要的頻率響應與實際頻率響應之間的積分平方誤差(Integral Squared Error,ISE)最小化:「最良」には基準が要る。もっとも自然な第一の選択は、望みの周波数応答と実際の周波数応答との積分二乗誤差(Integral Squared Error、ISE)を最小にすることである:

Integral squared error積分平方誤差積分二乗誤差 $$\phi \;=\; \frac{1}{2\pi}\int_{-\pi}^{\pi}\bigl|H_d(e^{j\omega}) - H_t(e^{j\omega})\bigr|^{2}\,d\omega , \qquad H_t(e^{j\omega}) = \mathrm{DTFT}\{h_t[n]\}$$

14.1.2 Parseval and the optimal truncation14.1.2 帕塞瓦爾定理與最佳截斷14.1.2 パーセバルの定理と最適な打ち切り

The ideal impulse response is $h_d[n] = \mathrm{IDTFT}\{H_d(e^{j\omega})\}$, which is usually infinite-extent. By Parseval’s theorem(帕塞瓦爾定理), the frequency-domain error equals a time-domain error:理想脈衝響應是 $h_d[n] = \mathrm{IDTFT}\{H_d(e^{j\omega})\}$,它通常是無限長的。依帕塞瓦爾定理(Parseval 定理),頻域裡的誤差等於時域裡的誤差:理想インパルス応答は $h_d[n] = \mathrm{IDTFT}\{H_d(e^{j\omega})\}$ であり、ふつう無限に広がる。パーセバルの定理により、周波数領域の誤差は時間領域の誤差に等しい:

ISE in the time domain (Parseval)時域中的 ISE(帕塞瓦爾)時間領域の ISE(パーセバル) $$\phi \;=\; \sum_{n=-\infty}^{\infty}\bigl|h_d[n]-h_t[n]\bigr|^{2}$$

Now constrain $h_t[n]$ to exist only for $n = -M,\dots,M$ (length $2M+1$). Split the sum:現在限制 $h_t[n]$ 只在 $n = -M,\dots,M$ 上存在(長度 $2M+1$)。把這個和式拆開:ここで $h_t[n]$ が $n = -M,\dots,M$ でのみ存在するよう制約する(長さ $2M+1$)。和を分割する:

Split the error把誤差拆開誤差を分割する $$\phi \;=\; \underbrace{\sum_{n=-M}^{M}\bigl|h_d[n]-h_t[n]\bigr|^{2}}_{\text{minimized by } h_t[n]\,=\,h_d[n]} \;+\; \underbrace{\sum_{n<-M,\;n>M}\bigl|h_d[n]\bigr|^{2}}_{\text{not altered by } h_t[n]}$$

The second term is fixed; the first is zeroed by simply copying $h_d[n]$ inside the support. So the minimum mean-squared-error FIR approximation of length $2M+1$ is the truncated IDTFT(截斷的反離散時間傅立葉變換):第二項是固定的;第一項只要在支撐範圍內直接照抄 $h_d[n]$ 就會歸零。所以長度 $2M+1$ 的最小均方誤差 FIR 逼近,就是截斷的 IDTFT(截斷的反離散時間傅立葉變換):第二項は固定である。第一項は台の内側で $h_d[n]$ をそのまま写すだけでゼロになる。したがって長さ $2M+1$ の最小平均二乗誤差 FIR 近似は、打ち切った IDTFT(逆離散時間フーリエ変換)である:

Optimal (least-ISE) truncation最佳(最小 ISE)截斷最適(最小 ISE)な打ち切り $$h_t[n] \;=\; \begin{cases} \dfrac{1}{2\pi}\displaystyle\int_{-\pi}^{\pi} H_d(e^{j\omega})\,e^{j\omega n}\,d\omega , & -M \le n \le M \\[4pt] 0, & \text{otherwise} \end{cases}$$
Key result關鍵結果重要な結論
In the least-squares sense, the best length-$(2M+1)$ FIR approximation of any desired response is obtained by keeping the middle $2M+1$ samples of the ideal impulse response and discarding the rest. No fancy optimization needed — truncation is the ISE-optimal answer.在最小平方的意義下,任何想要的響應,其長度為 $(2M+1)$ 的最佳 FIR 逼近,都是保留理想脈衝響應正中間的 $2M+1$ 個樣本,其餘全部丟掉。不需要任何花俏的最佳化——截斷本身就是 ISE 最佳解。最小二乗の意味では、どんな望みの応答であっても、長さ $(2M+1)$ の最良の FIR 近似は理想インパルス応答の中央 $2M+1$ 標本を残し、残りを捨てることで得られる。凝った最適化は要らない —— 打ち切りこそが ISE 最適の答えである。
直觀解釋(點擊展開)
Parseval 定理說「頻域的總誤差能量 = 時域的總誤差能量」。既然 $h_t[n]$ 只能在 $-M\le n\le M$ 內非零,視窗外的誤差 $\sum_{|n|>M}|h_d[n]|^2$ 是注定逃不掉的;我們唯一能做的就是把視窗內的誤差降到 0 —— 也就是直接複製 $h_d[n]$。所以「截斷」不是偷懶,它正是最小平方誤差的最佳解。但注意:最佳是以「平方誤差總量」衡量,不代表每個頻率點的誤差都小(見 Gibbs 現象)。

14.1.3 Making it causal14.1.3 讓它成為因果14.1.3 因果にする

The truncated $h_t[n]$ is symmetric around $n=0$, hence noncausal. Make it causal(因果) by delaying $M$ samples:截斷後的 $h_t[n]$ 對 $n=0$ 對稱,因此是非因果的。延遲 $M$ 個樣本,就讓它成為因果的:打ち切った $h_t[n]$ は $n=0$ について対称なので非因果である。$M$ 標本遅らせて因果にする:

Causal shift因果位移因果にするシフト $$h_t'[n] \;=\; h_t[n-M] \qquad\Rightarrow\qquad h_t'[n] = 0 \;\text{ for } n < 0,\quad \text{support } 0 \le n \le 2M$$
Why the delay is harmless為什麼這個延遲無害なぜこの遅延は無害か
A pure delay multiplies the frequency response by $e^{-j\omega M}$: the magnitude $|H_t'(e^{j\omega})| = |H_t(e^{j\omega})|$ is untouched, and the phase becomes exactly linear phase(線性相位) $-\omega M$, because the delayed impulse response is symmetric about its midpoint $n = M$. Linear phase = constant group delay of $M$ samples = no phase distortion, just latency.純延遲只是把頻率響應乘上 $e^{-j\omega M}$:大小 $|H_t'(e^{j\omega})| = |H_t(e^{j\omega})|$ 完全不動,而相位恰好成為線性相位 $-\omega M$,因為延遲後的脈衝響應對其中點 $n = M$ 對稱。線性相位=固定 $M$ 個樣本的群延遲=沒有相位失真,只有延時。純遅延は周波数応答に $e^{-j\omega M}$ を掛けるだけである:振幅 $|H_t'(e^{j\omega})| = |H_t(e^{j\omega})|$ は変わらず、位相はちょうど線形位相 $-\omega M$ になる。遅らせたインパルス応答が中点 $n = M$ について対称だからである。線形位相= $M$ 標本の一定な群遅延=位相歪みはなく、遅れだけである。

14.2 Approximating Ideal Filters14.2 逼近理想濾波器14.2 理想フィルタの近似

14.2.1 Ideal lowpass pair14.2.1 理想低通的一對14.2.1 理想低域通過フィルタの対

Recall (from the Fourier-domain chapter) the ideal lowpass filter(理想低通濾波器) with cutoff $\omega_c$:回想一下(傅立葉域那一章)截止頻率為 $\omega_c$ 的理想低通濾波器:(フーリエ領域の章から)遮断周波数 $\omega_c$ の理想低域通過フィルタを思い出そう:

Ideal LPF: frequency response and impulse response理想低通:頻率響應與脈衝響應理想低域通過フィルタ:周波数応答とインパルス応答 $$H_{LP}(e^{j\omega}) = \begin{cases} 1, & |\omega| < \omega_c \\ 0, & \omega_c < |\omega| \le \pi \end{cases} \qquad\Longleftrightarrow\qquad h_{LP}[n] = \frac{\sin \omega_c n}{\pi n}\quad(\text{doubly infinite})$$

The sinc-shaped $h_{LP}[n]$ extends from $-\infty$ to $\infty$ and decays only like $1/n$ — it can never be realized exactly. Applying the recipe of §14.1:sinc 形狀的 $h_{LP}[n]$ 從 $-\infty$ 延伸到 $\infty$,而且衰減只有 $1/n$ 那麼慢——它永遠無法被精確實現。把 §14.1 的配方套上去:sinc 形の $h_{LP}[n]$ は $-\infty$ から $\infty$ まで広がり、減衰は $1/n$ 程度でしかない —— 厳密に実現することはできない。§14.1 の処方を当てはめると:

Minimum-ISE causal FIR lowpass (length 2M+1)最小 ISE 的因果 FIR 低通(長度 2M+1)最小 ISE の因果 FIR 低域通過フィルタ(長さ 2M+1) $$\hat h_{LP}[n] \;=\; \begin{cases} \dfrac{\sin \omega_c (n-M)}{\pi\,(n-M)} , & 0 \le n \le 2M \\[4pt] 0 , & \text{otherwise} \end{cases}$$

(at $n = M$ the value is $\omega_c/\pi$ by the limit). The shift $n \to n-M$ is the causal delay.(在 $n = M$ 處,取極限其值為 $\omega_c/\pi$)。位移 $n \to n-M$ 就是那個讓它成為因果的延遲。($n = M$ では極限をとって値は $\omega_c/\pi$ である。)シフト $n \to n-M$ が因果にするための遅延である。

14.2.2 Windowed-sinc design steps14.2.2 加窗 sinc 的設計步驟14.2.2 窓かけ sinc 設計の手順

Fig. 14-1 shows the whole pipeline for $\omega_c = 0.3\pi$, $M = 12$: take the ideal sinc, keep $2M+1 = 25$ central samples, shift right by $M$, then look at the magnitude response.圖 14-1 把 $\omega_c = 0.3\pi$、$M = 12$ 的整條流程畫了出來:取理想 sinc,保留中央 $2M+1 = 25$ 個樣本,向右位移 $M$,然後看它的大小響應。図 14-1 は $\omega_c = 0.3\pi$、$M = 12$ の場合の流れ全体を示している:理想 sinc をとり、中央の $2M+1 = 25$ 標本を残し、右へ $M$ だけシフトし、そのうえで振幅応答を見る。

2026-06-12T22:40:38.411971 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −20 −10 0 10 20 n 0.0 0.1 0.2 0.3 h_d[n] (a) Ideal IR h_d[n] = sin(0.3pin)/(pin) (doubly infinite; keep |n| <= M) 0 5 10 15 20 25 n 0.0 0.1 0.2 0.3 h_LP[n] (b) Truncate to 2M+1 = 25 points and delay by M = 12 -> causal h_LP[n] 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi 0.0 0.2 0.4 0.6 0.8 1.0 magnitude (c) Magnitude of the truncated design vs. ideal brick wall |H_t|, N = 25 (rect.) ideal H_d
Fig. 14-1 — Windowed-sinc lowpass design steps: (a) ideal $h_d[n]$ with the kept region shaded, (b) truncated and delayed causal impulse response, (c) resulting magnitude vs. the ideal brick wall. Note the ripples near the cutoff.(理想 sinc 截斷 → 右移成因果 → 頻率響應出現過渡帶與漣波)圖 14-1 — 加窗 sinc 低通的設計步驟:(a) 理想的 $h_d[n]$,保留區域以陰影標示;(b) 截斷並延遲後的因果脈衝響應;(c) 得到的大小響應與理想磚牆的對照。注意截止頻率附近出現的漣波。図 14-1 — 窓かけ sinc 低域通過設計の手順:(a) 理想の $h_d[n]$、残す区間を網かけで示す。(b) 打ち切って遅延させた因果インパルス応答。(c) 得られた振幅応答と理想のレンガ壁との比較。遮断周波数付近にリップルが現れていることに注意。
Common exam trap常見的考試陷阱よくある試験の落とし穴
The truncated design is optimal in integrated squared error, not in worst-case (minimax) error. Panel (c) of Fig. 14-1 already shows the price: an overshoot of about 9% right next to the discontinuity that no amount of filter length will remove — the Gibbs phenomenon of §14.3.截斷設計在積分平方誤差的意義下是最佳的,但在最壞情況(極大極小)誤差下並不是。圖 14-1 的 (c) 已經把代價攤開來了:緊鄰不連續點處有約 9% 的過衝,而且不論濾波器加到多長都去不掉——這就是 §14.3 的 Gibbs 現象。打ち切り設計が最適なのは積分二乗誤差の意味であって、最悪値(ミニマックス)誤差の意味ではない。図 14-1 の (c) がすでにその代償を示している:不連続点のすぐ隣に約 9% のオーバーシュートがあり、フィルタをどれだけ長くしても消えない —— §14.3 のギブス現象である。

14.3 Gibbs Phenomenon14.3 Gibbs 現象14.3 ギブス現象

14.3.1 Truncated ideal filters have Gibbs “ears”14.3.1 截斷後的理想濾波器會長出 Gibbs「耳朵」14.3.1 打ち切った理想フィルタにはギブスの「耳」が生える

Plotting $|H_t(e^{j\omega})|$ for two lengths (25 and 129 points) reveals the Gibbs phenomenon(吉布斯現象): oscillatory ripples that pile up near the band edge, with a peak overshoot of about 9% of the discontinuity size.把兩種長度(25 點與 129 點)的 $|H_t(e^{j\omega})|$ 畫出來,就看得見Gibbs 現象:在頻帶邊緣堆積起來的振盪漣波,其尖峰過衝約為不連續跳躍量的 9%。二つの長さ(25 点と 129 点)について $|H_t(e^{j\omega})|$ を描くと、ギブス現象が見えてくる:帯域端に積み重なる振動的なリップルであり、そのピークのオーバーシュートは不連続の跳び幅のおよそ 9% である。

2026-06-12T22:40:38.675583 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi 0.0 0.2 0.4 0.6 0.8 1.0 1.2 |H_t| Gibbs ears: ~9% overshoot, height does NOT shrink with N Rectangular truncation of ideal LPF (omega_c = 0.3pi): ears narrow but never flatten 25-point (M=12) 129-point (M=64)
Fig. 14-2 — Gibbs “ears” for rectangular truncation at $N=25$ and $N=129$. Increasing the length makes the ears narrower (so the ISE does decrease) but their height stays the same (~9% overshoot).(加長濾波器只會讓「耳朵」變窄、不會變矮)圖 14-2 — 矩形截斷在 $N=25$ 與 $N=129$ 時的 Gibbs「耳朵」。加長長度會讓耳朵變窄(所以 ISE 的確下降),但它們的高度不變(約 9% 過衝)。図 14-2 — 矩形打ち切りによるギブスの「耳」、$N=25$ と $N=129$ の場合。長さを増やすと耳は細くなる(だから ISE は確かに減る)が、その高さは変わらない(約 9% のオーバーシュート)。
Must remember必記必ず覚えること
Increasing filter length $\Rightarrow$ narrower ears (reduces ISE) but the ear height stays $\approx 9\%$. Therefore the truncated design is not optimal by the minimax criterion(極大極小準則) — its worst-case error never improves.加長濾波器長度 $\Rightarrow$ 耳朵變窄(ISE 下降),但耳朵高度仍停在 $\approx 9\%$。因此截斷設計在極大極小準則下並非最佳——它的最壞情況誤差永遠不會改善。フィルタ長を増やす $\Rightarrow$ 耳は細くなる(ISE は減る)が、耳の高さは $\approx 9\%$ のままである。したがって打ち切り設計はミニマックス基準では最適でない —— 最悪値誤差は決して改善しない。

14.3.2 Where Gibbs comes from14.3.2 Gibbs 現象從何而來14.3.2 ギブス現象はどこから来るか

Truncation of $h_d[n]$ to $2M+1$ points is multiplication by a rectangular window(矩形窗):把 $h_d[n]$ 截斷成 $2M+1$ 點,就是乘上一個矩形窗:$h_d[n]$ を $2M+1$ 点に打ち切ることは、矩形窓を掛けることである:

Truncation = windowing截斷=加窗打ち切り=窓かけ $$h_t[n] \;=\; h_d[n]\cdot w_R[n], \qquad w_R[n] = \begin{cases} 1, & -M \le n \le M \\ 0, & \text{otherwise} \end{cases}$$

Multiplication in the time domain is (periodic) convolution in the frequency domain(頻域摺積) — the modulation/windowing theorem:時域裡的相乘,就是頻域裡的(週期)摺積——也就是調變/加窗定理:時間領域の掛け算は、周波数領域の(周期)畳み込みである —— 変調(窓かけ)定理:

Modulation (windowing) theorem調變(加窗)定理変調(窓かけ)定理 $$g[n]\cdot h[n] \;\;\longleftrightarrow\;\; \frac{1}{2\pi}\int_{-\pi}^{\pi} G(e^{j\theta})\,H\!\left(e^{j(\omega-\theta)}\right) d\theta$$

So the frequency response of the truncated filter is the ideal brick wall smeared by the DTFT of the rectangular window, which is the periodic sinc(週期 sinc / Dirichlet 核):所以截斷後濾波器的頻率響應,就是理想磚牆被矩形窗的 DTFT 抹開的結果,而那個 DTFT 就是週期 sinc(Dirichlet 核):したがって打ち切ったフィルタの周波数応答は、理想のレンガ壁が矩形窓の DTFT によってにじまされたものであり、その DTFT が周期 sinc(ディリクレ核)である:

Rectangular window spectrum矩形窗的頻譜矩形窓のスペクトル $$W_R(e^{j\omega}) \;=\; \sum_{n=-M}^{M} e^{-j\omega n} \;=\; \frac{\sin\!\left((2M+1)\,\omega/2\right)}{\sin\left(\omega/2\right)}$$
2026-06-12T22:40:38.919836 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00 omega/pi −2.5 0.0 2.5 5.0 7.5 10.0 12.5 15.0 W_R mainlobe, width 4pi/(2M+1) sidelobes -> ripples (~invariant with length) DTFT of rectangular window (M = 7): periodic sinc sin((2M+1)w/2)/sin(w/2)
Fig. 14-3 — The periodic sinc $W_R(e^{j\omega})$ for $M=7$. Mainlobe (shaded) has width $4\pi/(2M+1)$; the first zero crossings sit at $\pm 2\pi/(2M+1)$. Sidelobes oscillate with nearly length-invariant relative height.(矩形窗的頻譜:主瓣決定過渡帶,旁瓣決定漣波)圖 14-3 — $M=7$ 時的週期 sinc $W_R(e^{j\omega})$。主瓣(陰影處)寬度為 $4\pi/(2M+1)$;最早的零交越落在 $\pm 2\pi/(2M+1)$。旁瓣會振盪,其相對高度幾乎與長度無關。図 14-3 — $M=7$ のときの周期 sinc $W_R(e^{j\omega})$。主ローブ(網かけ)の幅は $4\pi/(2M+1)$、最初の零交差は $\pm 2\pi/(2M+1)$ にある。サイドローブは振動し、その相対高さは長さにほとんど依存しない。

As the mainlobe slides across the ideal discontinuity at $\omega_c$, the running integral of the sidelobes produces the ripples: in the passband the result oscillates around 1, in the transition it rolls off across the mainlobe width, and in the stopband it oscillates around 0. This is exactly the “type of approximation obtained at a discontinuity of an ideal frequency response” pictured on the slides.當主瓣滑過 $\omega_c$ 處的理想不連續點時,旁瓣的累積積分就製造出漣波:在通帶裡結果繞著 1 振盪,在過渡帶裡它在主瓣寬度上滾降,在阻帶裡則繞著 0 振盪。這正是投影片上畫的「理想頻率響應在不連續處所得到的那種逼近」。主ローブが $\omega_c$ の理想的な不連続点を横切っていくとき、サイドローブの積分の積み重ねがリップルを生む:通過帯域では結果が 1 のまわりで振動し、遷移帯域では主ローブ幅のあいだに落ちていき、阻止帯域では 0 のまわりで振動する。これがスライドに描かれた「理想周波数応答の不連続点で得られる近似の様子」そのものである。

14.3.3 Mainlobe vs. sidelobes — who controls what14.3.3 主瓣與旁瓣——誰管哪一件事14.3.3 主ローブとサイドローブ —— どちらが何を決めるか

The two knobs of windowed design加窗設計的兩個旋鈕窓かけ設計の二つのつまみ
  • Mainlobe width(主瓣寬度) $\propto 1/L$ (inverse of window length) ⟶ determines the transition band(過渡帶) width. Longer filter ⇒ sharper transition.主瓣寬度 $\propto 1/L$(視窗長度的倒數)⟶ 決定過渡帶的寬度。濾波器越長 ⇒ 過渡越陡。主ローブ幅 $\propto 1/L$(窓長の逆数)⟶ 遷移帯域の幅を決める。フィルタが長いほど遷移は急になる。
  • Sidelobe height(旁瓣高度) ⟶ determines the ripples(漣波) in passband and stopband. It is set by the window shape and is ≈ invariant with length — you cannot ripple your way out by adding taps.旁瓣高度 ⟶ 決定通帶與阻帶裡的漣波。它由視窗的形狀決定,而且幾乎與長度無關——你沒辦法靠多加抽頭把漣波壓掉。サイドローブの高さ ⟶ 通過帯域と阻止帯域のリップルを決める。これは窓の形状で決まり、長さにはほぼ依存しない —— タップを増やしてリップルから逃げることはできない。
直觀解釋(點擊展開)
把理想磚牆響應想成一張清晰的圖,窗函數的頻譜 $W(e^{j\omega})$ 是一支「模糊刷」。刷子的主瓣寬度決定邊緣被塗開多寬(過渡帶);刷毛旁邊的旁瓣則在平坦區留下波紋(漣波)。把濾波器加長,刷子整體變細(過渡帶縮小),但旁瓣相對於主瓣的高度比例不變,所以波紋高度不變 —— 這就是 Gibbs 耳朵不會變矮的原因。想要更低的漣波,必須換一支「旁瓣更低」的刷子(換窗形),代價是主瓣更寬。

14.4 Window Shapes for FIR Filters14.4 FIR 濾波器的視窗形狀14.4 FIR フィルタのための窓形状

14.4.1 Commonly used windows14.4.1 常用的視窗14.4.1 よく使う窓

Since the rectangular window’s $-13$ dB sidelobes give only ~$-21$ dB stopband ripple, we trade mainlobe width for lower sidelobes by using tapered windows(漸變窗). With the symmetric convention $-M \le n \le M$ (length $2M+1$), the slides list:既然矩形窗 $-13$ dB 的旁瓣只能換到約 $-21$ dB 的阻帶漣波,我們就改用漸變窗,拿主瓣寬度去換更低的旁瓣。採用對稱慣例 $-M \le n \le M$(長度 $2M+1$),投影片列出:矩形窓の $-13$ dB のサイドローブでは阻止帯域リップルが約 $-21$ dB にしかならないので、先細りの窓を使って主ローブ幅をサイドローブの低さと交換する。対称な規約 $-M \le n \le M$(長さ $2M+1$)のもとで、スライドは次を挙げている:

Window definitions (−M ≤ n ≤ M)視窗定義(−M ≤ n ≤ M)窓の定義(−M ≤ n ≤ M) $$\begin{aligned} \text{Rectangular:}\quad & w[n] = 1 \\[2pt] \text{Hann:}\quad & w[n] = 0.5 + 0.5\cos\!\Bigl(2\pi\tfrac{n}{2M+1}\Bigr) \\[2pt] \text{Hamming:}\quad & w[n] = 0.54 + 0.46\cos\!\Bigl(2\pi\tfrac{n}{2M+1}\Bigr) \\[2pt] \text{Blackman:}\quad & w[n] = 0.42 + 0.5\cos\!\Bigl(2\pi\tfrac{n}{2M+1}\Bigr) + 0.08\cos\!\Bigl(2\pi\tfrac{2n}{2M+1}\Bigr) \end{aligned}$$

Qualitatively (matching the slide annotations): rectangular has big sidelobes; Hann has a double-width mainlobe but much lower sidelobes; Hamming has a reduced first sidelobe (the 0.54/0.46 split is tuned to partially cancel it); Blackman has a triple-width mainlobe with the lowest sidelobes of the four. The Bartlett(三角窗)window $w[n] = 1 - |n|/M$ also appears in the comparison table.定性地說(對照投影片上的註記):矩形窗有很大的旁瓣;Hann 的主瓣寬度加倍,但旁瓣低得多;Hamming 則把第一旁瓣壓下來(0.54/0.46 的拆法正是調來部分抵消它的);Blackman 的主瓣寬度變成三倍,四者之中旁瓣最低。比較表裡還會出現 Bartlett(三角窗)$w[n] = 1 - |n|/M$。定性的に言えば(スライドの注記に対応して)、矩形窓はサイドローブが大きい。Hann は主ローブ幅が二倍になるがサイドローブははるかに低い。Hamming は第一サイドローブが抑えられている(0.54/0.46 という分け方はそれを部分的に打ち消すよう調整されている)。Blackman は主ローブ幅が三倍で、四つのなかでもっともサイドローブが低い。比較表には Bartlett(三角窓)$w[n] = 1 - |n|/M$ も現れる。

2026-06-12T22:40:39.509757 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −10 0 10 0.0 0.2 0.4 0.6 0.8 1.0 Rectangular −10 0 10 0.0 0.2 0.4 0.6 0.8 1.0 Hann −10 0 10 0.0 0.2 0.4 0.6 0.8 1.0 Hamming −10 0 10 0.0 0.2 0.4 0.6 0.8 1.0 Blackman 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi −100 −80 −60 −40 −20 0 |W| (dB) Window spectra on dB scale (N = 25): mainlobe width vs. sidelobe level trade-off Rectangular Hann Hamming Blackman
Fig. 14-4 — Top: the four windows in the time domain ($N = 25$). Bottom: their spectra in dB. Rectangular: narrowest mainlobe, $-13$ dB sidelobes. Blackman: widest mainlobe (3×), sidelobes below $-57$ dB.(窗形比較:主瓣寬度與旁瓣高度互相犧牲)圖 14-4 — 上:四種視窗在時域的樣子($N = 25$)。下:它們的頻譜(dB)。矩形窗:主瓣最窄,旁瓣 $-13$ dB。Blackman:主瓣最寬(3 倍),旁瓣低於 $-57$ dB。図 14-4 — 上:四つの窓の時間領域の形($N = 25$)。下:それらのスペクトル(dB)。矩形窓は主ローブがもっとも狭く、サイドローブは $-13$ dB。Blackman は主ローブがもっとも広く(3 倍)、サイドローブは $-57$ dB より下。

14.4.2 Comparison of commonly used windows14.4.2 常用視窗的比較14.4.2 よく使う窓の比較

The standard table (Oppenheim & Schafer Table 7.2, reproduced on slide 18) — here $M$ is the filter order (window length $M+1$):標準表格(Oppenheim & Schafer 表 7.2,投影片第 18 頁重印)——這裡的 $M$ 是濾波器階數(視窗長度 $M+1$):標準的な表(Oppenheim & Schafer 表 7.2、スライド 18 枚目に再掲)—— ここでの $M$ はフィルタ次数である(窓長は $M+1$):

Type of window視窗種類窓の種類 Peak sidelobe amplitude (relative, dB)最大旁瓣振幅(相對,dB)最大サイドローブ振幅(相対、dB) Approx. mainlobe width主瓣寬度(約)主ローブ幅(概算) Peak approximation error $20\log_{10}\delta$ (dB)最大逼近誤差 $20\log_{10}\delta$(dB)最大近似誤差 $20\log_{10}\delta$(dB) Equivalent Kaiser $\beta$等效的 Kaiser $\beta$等価なカイザーの $\beta$ Transition width of equiv. Kaiser等效 Kaiser 的過渡帶寬度等価なカイザー窓の遷移幅
Rectangular矩形窗矩形窓−13$4\pi/(M+1)$−210$1.81\pi/M$
BartlettBartlett(三角窗)Bartlett(三角窓)−25$8\pi/M$−251.33$2.37\pi/M$
HannHann 窗Hann 窓−31$8\pi/M$−443.86$5.01\pi/M$
HammingHamming 窗Hamming 窓−41$8\pi/M$−534.86$6.27\pi/M$
BlackmanBlackman 窗Blackman 窓−57$12\pi/M$−747.04$9.19\pi/M$
Two different M conventions — don’t mix them兩套不同的 M 慣例——別混用二つの異なる M の規約 —— 混ぜてはいけない
The window formulas of §14.4.1 use $-M\le n\le M$, i.e. length $L = 2M+1$ and order $2M$. The table above (from O&S) uses $M$ = filter order, i.e. length $M+1$. When you plug numbers into “$8\pi/M$”, make sure $M$ is the order, not the half-width. On exams, state your convention explicitly.§14.4.1 的視窗公式用的是 $-M\le n\le M$,也就是長度 $L = 2M+1$、階數 $2M$。上面那張表(出自 O&S)用的 $M$ 則是濾波器階數,也就是長度 $M+1$。把數字代進「$8\pi/M$」時,要確定那個 $M$ 是階數而不是半寬。考試時請把你採用的慣例明白寫出來。§14.4.1 の窓の式は $-M\le n\le M$ を使っており、つまり長さ $L = 2M+1$、次数 $2M$ である。上の表(O&S による)の $M$ はフィルタ次数、すなわち長さは $M+1$ である。「$8\pi/M$」に数値を入れるときは、その $M$ が次数であって半幅でないことを確かめよ。試験では自分の規約を明示すること。
How to read the table on an exam考試時怎麼讀這張表試験でこの表をどう読むか
  • Peak approximation error = the stopband ripple you actually get in the filter (e.g. Hamming ⇒ about $-53$ dB stopband), which is better than the raw sidelobe level because the convolution integrates the sidelobes.最大逼近誤差=你在濾波器上實際拿到的阻帶漣波(例如 Hamming ⇒ 阻帶約 $-53$ dB),它比原始旁瓣位準還好,因為摺積把旁瓣積分掉了。最大近似誤差=実際にフィルタで得られる阻止帯域リップル(たとえば Hamming ⇒ 阻止帯域は約 $-53$ dB)である。畳み込みがサイドローブを積分するので、素のサイドローブ準位より良くなる。
  • The window shape fixes the ripple $\delta$; the window length then fixes the transition width. Two specs ⇒ two knobs.視窗的形狀定下漣波 $\delta$;視窗的長度再定下過渡帶寬度。兩項規格 ⇒ 兩個旋鈕。窓の形状がリップル $\delta$ を決め、窓の長さが遷移幅を決める。仕様が二つ ⇒ つまみも二つ。
  • Windowed designs always give $\delta_p = \delta_s$ — equal passband and stopband ripple (see §14.5.3).加窗設計一定給出 $\delta_p = \delta_s$——通帶與阻帶的漣波相等(見 §14.5.3)。窓関数法の設計では必ず $\delta_p = \delta_s$ になる —— 通過帯域と阻止帯域のリップルが等しい(§14.5.3 参照)。

14.4.3 Adjustable windows: the Kaiser window14.4.3 可調視窗:Kaiser 視窗14.4.3 可変の窓:カイザー窓

The fixed windows offer only discrete main-sidelobe trade-offs. The Kaiser window(凱瑟窗) is parametric: a continuous knob $\beta$ sweeps the trade-off.固定形狀的視窗,只提供離散的主瓣—旁瓣取捨。Kaiser 視窗(凱瑟窗)則是帶參數的:一個連續的旋鈕 $\beta$ 就能掃過整條取捨曲線。形の決まった窓は離散的な主ローブ・サイドローブのトレードオフしか与えない。カイザー窓はパラメトリックである:連続したつまみ $\beta$ がトレードオフを掃いていく。

Kaiser windowKaiser 視窗カイザー窓 $$w[n] \;=\; \frac{I_0\!\left(\beta\sqrt{1-\left(\frac{n}{M}\right)^{2}}\,\right)}{I_0(\beta)}, \qquad -M \le n \le M$$

where $I_0(\cdot)$ is the modified zero-order Bessel function(零階修正貝索函數). $\beta = 0$ gives the rectangular window; larger $\beta$ tapers harder ⇒ lower sidelobes, wider mainlobe.其中 $I_0(\cdot)$ 是零階修正貝索函數。$\beta = 0$ 給出矩形窗;$\beta$ 越大漸變越劇烈 ⇒ 旁瓣更低、主瓣更寬。ここで $I_0(\cdot)$ は0 次の変形ベッセル関数である。$\beta = 0$ は矩形窓を与え、$\beta$ が大きいほど強く先細りになる ⇒ サイドローブは低く、主ローブは広くなる。

2026-06-12T22:40:39.958636 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −10 −5 0 5 10 n 0.0 0.2 0.4 0.6 0.8 1.0 w[n] envelope Kaiser window shape (M = 12) beta = 0 beta = 3 beta = 6 beta = 9 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi −100 −80 −60 −40 −20 0 dB Spectra: beta trades mainlobe vs sidelobes beta = 0 beta = 3 beta = 6 beta = 9
Fig. 14-5 — Kaiser window family for $\beta = 0, 3, 6, 9$ ($M=12$): shapes (left) and spectra (right). One parameter continuously trades mainlobe width against sidelobe level.($\beta$ 連續調整主瓣/旁瓣的取捨)圖 14-5 — $\beta = 0, 3, 6, 9$($M=12$)的 Kaiser 視窗家族:左為形狀,右為頻譜。單一參數 $\beta$ 就能在主瓣寬度與旁瓣位準之間連續權衡。図 14-5 — $\beta = 0, 3, 6, 9$($M=12$)のカイザー窓の族:左が形状、右がスペクトル。たった一つのパラメータ $\beta$ が主ローブ幅とサイドローブ準位を連続的に交換する。

Kaiser also gave empirical design formulas. Given the required minimum stopband attenuation $\alpha$ in dB (with $\alpha = -20\log_{10}\delta$) and the transition width $\Delta\omega = \omega_s - \omega_p$:Kaiser 還給了經驗設計公式。給定所需的最小阻帶衰減 $\alpha$(以 dB 計,其中 $\alpha = -20\log_{10}\delta$)以及過渡帶寬度 $\Delta\omega = \omega_s - \omega_p$:カイザーは経験的な設計式も与えた。必要な最小阻止帯域減衰量 $\alpha$(dB 単位、ただし $\alpha = -20\log_{10}\delta$)と遷移幅 $\Delta\omega = \omega_s - \omega_p$ が与えられたとき:

Kaiser β from stopband attenuation α (dB)由阻帶衰減 α(dB)求 Kaiser 的 β阻止帯域減衰量 α(dB)から求めるカイザーの β $$\beta \;=\; \begin{cases} 0.1102\,(\alpha - 8.7), & \alpha > 50 \\[2pt] 0.5842\,(\alpha - 21)^{0.4} + 0.07886\,(\alpha - 21), & 21 \le \alpha \le 50 \\[2pt] 0, & \alpha < 21 \end{cases}$$
Required order from transition width由過渡帶寬度求所需階數遷移幅から求める必要次数 $$N \;\approx\; \frac{\alpha - 8}{2.3\,\Delta\omega}$$

(The slides round the coefficients to $0.11$, $0.58$, $0.08$ and use $2.3$; Oppenheim & Schafer’s constant is $2.285$ — same formula to slide precision.) Note that for $\alpha < 21$ dB the Kaiser window degenerates to rectangular: you cannot ask for less ripple than Gibbs gives for free.(投影片把係數四捨五入成 $0.11$、$0.58$、$0.08$,並取 $2.3$;Oppenheim & Schafer 的常數是 $2.285$——在投影片的精度下是同一條公式。)注意當 $\alpha < 21$ dB 時,Kaiser 視窗會退化成矩形窗:你沒辦法要求比 Gibbs 免費給你的還小的漣波。(スライドは係数を $0.11$、$0.58$、$0.08$ に丸め、$2.3$ を使っている。Oppenheim & Schafer の定数は $2.285$ であり —— スライドの精度では同じ式である。)$\alpha < 21$ dB ではカイザー窓が矩形窓に退化することに注意せよ:ギブスがただでくれるより小さいリップルを要求することはできない。

MATLABMATLAB 實作MATLAB での実装
kaiser(N,beta) generates the window; kaiserord turns a spec $\{\omega_p,\omega_s,\delta_p,\delta_s\}$ directly into [n, Wn, beta, ftype] for fir1. The generic windowed design is one line: h = fir1(n, Wn, kaiser(n+1, beta)). For other windows use hann, hamming, blackman with fir1(n, Wn, window).kaiser(N,beta) 產生視窗;kaiserord 把規格 $\{\omega_p,\omega_s,\delta_p,\delta_s\}$ 直接轉成給 fir1 用的 [n, Wn, beta, ftype]。一般的加窗設計只要一行:h = fir1(n, Wn, kaiser(n+1, beta))。其他視窗就用 hann、hamming、blackman 搭配 fir1(n, Wn, window)。kaiser(N,beta) が窓を生成する。kaiserord は仕様 $\{\omega_p,\omega_s,\delta_p,\delta_s\}$ をそのまま fir1 用の [n, Wn, beta, ftype] へ変換する。一般の窓関数法設計は一行である:h = fir1(n, Wn, kaiser(n+1, beta))。他の窓を使うなら hann、hamming、blackman を fir1(n, Wn, window) と組み合わせる。

14.5 Windowed Design in Practice14.5 視窗法的實務設計14.5 実務における窓関数法設計

14.5.1 Worked example: 25-point Hamming lowpass14.5.1 範例:25 點 Hamming 低通14.5.1 例題:25 点 Hamming 低域通過フィルタ

Example 14-1 — Design a 25-point FIR low-pass filter with cutoff 600 Hz (sampling rate 8 kHz)範例 14-1 — 設計一個 25 點的 FIR 低通濾波器,截止頻率 600 Hz(取樣率 8 kHz)例題 14-1 — 遮断周波数 600 Hz の 25 点 FIR 低域通過フィルタを設計する(標本化周波数 8 kHz)

No specific transition/ripple requirements are given, so we compromise with a Hamming window.題目沒有給定過渡帶/漣波的具體要求,所以我們折衷採用 Hamming 窗。遷移幅やリップルの具体的な要求は与えられていないので、折衷として Hamming 窓を使う。

Step 0 — convert to radians/sample:步驟 0 — 換算成每樣本的弧度:手順 0 —— 1 標本あたりのラジアンに換算する: $$\omega_c \;=\; \frac{600}{8000}\times 2\pi \;=\; 0.15\pi \ \text{rad/sample}$$ (600 cycles/sec ÷ 8000 samples/sec × 2π rad/cycle.)(每秒 600 週 ÷ 每秒 8000 個樣本 × 每週 2π 弧度。)(毎秒 600 周期 ÷ 毎秒 8000 標本 × 1 周期あたり 2π ラジアン。)
Step 1 — ideal impulse response:步驟 1 — 理想脈衝響應:手順 1 —— 理想インパルス応答: $$h_d[n] = \frac{\sin 0.15\pi n}{\pi n}$$
Step 2 — get the window: Hamming at $N = 25 \Rightarrow M = 12$ (since $N = 2M+1$):步驟 2 — 取出視窗:$N = 25 \Rightarrow M = 12$ 的 Hamming 窗(因為 $N = 2M+1$):手順 2 —— 窓を用意する:$N = 25 \Rightarrow M = 12$ の Hamming 窓($N = 2M+1$ だから): $$w[n] = 0.54 + 0.46\cos\!\Bigl(2\pi\frac{n}{25}\Bigr), \qquad -12 \le n \le 12$$
Step 3 — apply the window:步驟 3 — 加上視窗:手順 3 —— 窓を掛ける: $$h[n] = h_d[n]\cdot w[n] = \frac{\sin 0.15\pi n}{\pi n}\Bigl(0.54 + 0.46\cos\frac{2\pi n}{25}\Bigr), \quad -12 \le n \le 12$$ then delay by 12 samples for causality.然後延遲 12 個樣本以取得因果性。そのあと因果性のために 12 標本遅らせる。
2026-06-12T22:40:40.455643 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 5 10 15 20 25 n 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 h[n] h[n] = h_d[n-12] w[n-12], N = 25 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi −100 −80 −60 −40 −20 0 |H| (dB) omega_c = 0.15pi (600 Hz @ 8 kHz) Magnitude: ~ -53 dB stopband (Hamming)
Fig. 14-6 — Example 14-1 result: causal impulse response (left) and magnitude in dB (right). The Hamming window delivers its promised ≈ −53 dB stopband; the transition is centered on $\omega_c = 0.15\pi$ (600 Hz at $f_s$ = 8 kHz).(25 點 Hamming 視窗低通:阻帶約 −53 dB)圖 14-6 — 範例 14-1 的結果:左為因果脈衝響應,右為以 dB 表示的大小響應。Hamming 窗如約交出約 −53 dB 的阻帶;過渡帶以 $\omega_c = 0.15\pi$ 為中心(在 $f_s$ = 8 kHz 下即 600 Hz)。図 14-6 — 例題 14-1 の結果:左が因果インパルス応答、右が dB 表示の振幅。Hamming 窓は約束どおり約 −53 dB の阻止帯域を与える。遷移帯域は $\omega_c = 0.15\pi$ を中心とする($f_s$ = 8 kHz では 600 Hz)。

14.5.2 Frequency-response (FR) arithmetic14.5.2 頻率響應(FR)的加減運算14.5.2 周波数応答(FR)の算術

The ideal LPF has a pure-real frequency response: $\theta(\omega) = 0$, $H(e^{j\omega}) = |H(e^{j\omega})|$. Pure-real responses can be added and subtracted like numbers, so piecewise-constant ideal responses are built from ideal lowpass blocks. Example — an ideal highpass(高通):理想低通濾波器的頻率響應是純實數的:$\theta(\omega) = 0$、$H(e^{j\omega}) = |H(e^{j\omega})|$。純實數的響應可以像數字一樣相加相減,所以分段常數的理想響應,都能用理想低通積木拼出來。舉例——一個理想高通:理想低域通過フィルタの周波数応答は純実数である:$\theta(\omega) = 0$、$H(e^{j\omega}) = |H(e^{j\omega})|$。純実数の応答は数のように足し引きできるので、区分的に一定な理想応答は理想低域通過のブロックから組み立てられる。たとえば理想高域通過は:

Highpass from allpass minus lowpass全通減去低通就是高通全域通過から低域通過を引いて高域通過を作る $$H_{HP}(e^{j\omega}) = 1 - H_{LP}(e^{j\omega}) \qquad\Longleftrightarrow\qquad h_{HP}[n] \;=\; \delta[n] - \frac{\sin \omega_c n}{\pi n}$$

since $\delta[n] \leftrightarrow H(e^{j\omega}) = 1$ (allpass). The same arithmetic gives bandpass and bandstop responses (Exercise 5).因為 $\delta[n] \leftrightarrow H(e^{j\omega}) = 1$(全通)。同樣的加減運算也給得出帶通與帶阻的響應(習題 5)。$\delta[n] \leftrightarrow H(e^{j\omega}) = 1$(全域通過)だからである。同じ算術で帯域通過と帯域阻止の応答も得られる(演習 5)。

This wouldn’t work if phases were nonzero!如果相位不是零,這一招就行不通!位相がゼロでなければ、この手は通用しない!
$|H_1 + H_2| \ne |H_1| + |H_2|$ in general. FR arithmetic relies on the ideal responses being zero-phase (pure real). After designing, you may delay the final $h[n]$ for causality — a common error is to subtract responses that carry different delays, which scrambles the magnitudes.一般而言 $|H_1 + H_2| \ne |H_1| + |H_2|$。頻率響應的加減運算,靠的是理想響應都是零相位(純實數)。設計完之後,你可以把最後的 $h[n]$ 延遲以取得因果性——常見的錯誤是把帶有不同延遲的響應相減,那會把大小響應攪亂。一般に $|H_1 + H_2| \ne |H_1| + |H_2|$ である。周波数応答の算術は、理想応答がゼロ位相(純実数)であることに依存している。設計し終えたあとで最後の $h[n]$ を因果性のために遅らせてよい —— よくある誤りは、異なる遅延をもつ応答どうしを引き算することで、これは振幅をめちゃくちゃにする。

14.5.3 Window technique: “overdesign”14.5.3 視窗法:「過度設計」14.5.3 窓関数法:「過剰設計」

Window methods give you no independent control of passband vs. stopband ripple:視窗法不讓你獨立控制通帶漣波與阻帶漣波:窓関数法では、通過帯域リップルと阻止帯域リップルを独立に制御できない:

14.6 Design by Iterative Optimization; FIR vs. IIR14.6 用疊代最佳化設計;FIR 與 IIR14.6 反復最適化による設計;FIR と IIR

14.6.1 Equiripple design (Parks–McClellan)14.6.1 等漣波設計(Parks–McClellan)14.6.1 等リップル設計(Parks–McClellan)

Since the worst-case error of a windowed design is concentrated at the band edges, a better criterion is minimax(極大極小): minimize the maximum weighted error over passband and stopband. The optimal solution is equiripple(等漣波) — the error oscillates with equal peaks (alternation theorem), and the Parks–McClellan algorithm finds it by iterative Chebyshev approximation (Remez exchange). Every ripple is pushed down to exactly the spec, no accuracy is wasted, so for the same spec the equiripple filter needs fewer taps than any windowed design.既然加窗設計的最壞誤差集中在頻帶邊緣,更好的準則就是極大極小(minimax):把通帶與阻帶上加權誤差的最大值最小化。最佳解是等漣波的——誤差以等高的峰值振盪(交錯定理),而Parks–McClellan 演算法用疊代的 Chebyshev 逼近(Remez 交換法)把它找出來。每一個漣波都被壓到剛好貼著規格,沒有任何精度被浪費,所以在同一份規格下,等漣波濾波器需要的抽頭數比任何加窗設計都少。窓による設計の最悪誤差は帯域端に集中するので、より良い基準はミニマックスである:通過帯域と阻止帯域にわたる重み付き誤差の最大値を最小にする。最適解は等リップルである —— 誤差は等しい高さのピークで振動し(交代定理)、Parks–McClellan アルゴリズムが反復的なチェビシェフ近似(Remez 交換法)でそれを見つける。どのリップルもちょうど仕様に貼りつくまで押し下げられ、精度が無駄にならないので、同じ仕様なら等リップルフィルタはどんな窓設計よりも少ないタップで済む。

2026-06-12T22:40:40.729991 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi −80 −70 −60 −50 −40 −30 −20 −10 0 |H| (dB) stopband spec -40 dB passband spec -1 dB Same spec (wp=0.22pi, ws=0.29pi, A=40 dB): equiripple needs fewer taps Kaiser window, 65 taps (beta = 3.40) Parks-McClellan (equiripple), 45 taps
Fig. 14-7 — Same spec ($\omega_p = 0.22\pi$, $\omega_s = 0.29\pi$, $-1$ dB passband, $-40$ dB stopband): Kaiser window needs ~64 taps; the Parks–McClellan equiripple design meets it with 45 taps. Notice the equal-height stopband ripples of the equiripple design vs. the decaying ripples of the Kaiser design.(等漣波設計把每個漣波都「貼著規格」,因此階數更省)圖 14-7 — 同一份規格($\omega_p = 0.22\pi$、$\omega_s = 0.29\pi$、通帶 $-1$ dB、阻帶 $-40$ dB):Kaiser 視窗需要約 64 個抽頭;Parks–McClellan 等漣波設計只用 45 個抽頭就達標。注意等漣波設計的阻帶漣波高度一致,而 Kaiser 設計的漣波則逐漸衰減。図 14-7 — 同じ仕様($\omega_p = 0.22\pi$、$\omega_s = 0.29\pi$、通過帯域 $-1$ dB、阻止帯域 $-40$ dB):カイザー窓は約 64 タップを要するが、Parks–McClellan の等リップル設計は 45 タップで満たす。等リップル設計の阻止帯域リップルが同じ高さなのに対し、カイザー設計のリップルは減衰していくことに注目せよ。
MATLABMATLAB 實作MATLAB での実装
[n,fo,ao,w] = firpmord([fp fs], [1 0], [dp ds]) estimates the order, then h = firpm(n, fo, ao, w) runs Parks–McClellan (formerly remez). In Python: scipy.signal.remez.[n,fo,ao,w] = firpmord([fp fs], [1 0], [dp ds]) 估算階數,接著 h = firpm(n, fo, ao, w) 執行 Parks–McClellan(舊名 remez)。在 Python 裡則是 scipy.signal.remez。[n,fo,ao,w] = firpmord([fp fs], [1 0], [dp ds]) が次数を見積もり、続いて h = firpm(n, fo, ao, w) が Parks–McClellan を実行する(旧名は remez)。Python では scipy.signal.remez である。

14.6.2 Note on IIR and FIR design14.6.2 關於 IIR 與 FIR 設計的補充14.6.2 IIR と FIR の設計についての注

The slides close with a benchmark spec — passband edge $0.22\pi$, stopband edge $0.29\pi$, passband gain $0$ to $-1$ dB, stopband $\le -40$ dB — designed with every method (O&S Table 7.3):投影片以一份基準規格作結——通帶邊界 $0.22\pi$、阻帶邊界 $0.29\pi$、通帶增益 $0$ 到 $-1$ dB、阻帶 $\le -40$ dB——並用每一種方法都設計了一遍(O&S 表 7.3):スライドはベンチマーク仕様で締めくくられる —— 通過帯域端 $0.22\pi$、阻止帯域端 $0.29\pi$、通過帯域利得 $0$ から $-1$ dB、阻止帯域 $\le -40$ dB —— をあらゆる方法で設計した結果である(O&S 表 7.3):

Filter design濾波器設計法フィルタ設計法Order階數次数Type型態型式Multiplications (symmetric structure)乘法次數(對稱結構)乗算回数(対称構造)
ButterworthButterworth 濾波器Butterworth フィルタ18IIRIIR 型IIR 型—
Chebyshev IChebyshev 一型Chebyshev I 型8IIRIIR 型IIR 型—
Chebyshev IIChebyshev 二型Chebyshev II 型8IIRIIR 型IIR 型—
Elliptic橢圓楕円5IIRIIR 型IIR 型8
Kaiser (window)Kaiser(視窗法)Kaiser(窓関数法)63FIRFIR 型FIR 型32 (linear phase)32(線性相位)32(線形位相)
Parks–McClellanParks–McClellan 法Parks–McClellan 法44FIRFIR 型FIR 型23 (linear phase)23(線性相位)23(線形位相)
The FIR-vs-IIR verdictFIR 對 IIR 的結論FIR 対 IIR の結論
  • IIR requires far fewer multiplications (less complexity): elliptic order 5 ⇒ 8 multiplies vs. 23–32 for FIR.IIR 需要的乘法次數少得多(複雜度較低):橢圓 5 階 ⇒ 8 次乘法,FIR 則要 23–32 次。IIR は乗算回数がはるかに少なくて済む(複雑さが小さい):楕円の 5 次 ⇒ 8 回の乗算に対し、FIR は 23–32 回である。
  • FIR can achieve exactly linear phase (symmetric $h[n]$ — which also halves the multiplications) and has no stability concern (no poles outside $z=0$, no limit cycles).FIR 可以做到完全的線性相位(對稱的 $h[n]$——這同時把乘法次數減半),而且不必擔心穩定性(除了 $z=0$ 以外沒有極點,也沒有極限環)。FIR は厳密な線形位相を実現できる(対称な $h[n]$ —— これは乗算回数も半分にする)し、安定性の心配がない($z=0$ 以外に極がなく、リミットサイクルもない)。
  • Choose IIR when complexity dominates and phase doesn’t matter; choose FIR when linear phase / robustness matter.當複雜度是主要考量、相位又無所謂時選 IIR;當線性相位/穩健性重要時選 FIR。複雑さが支配的で位相が問題にならないときは IIR を、線形位相やロバスト性が効いてくるときは FIR を選ぶ。

14.7 Summary14.7 總結14.7 まとめ

Windowed design recipe加窗設計的配方窓関数法設計のレシピ

1) $\omega_c = 2\pi f_c/f_s$. 2) $h_d[n] = \mathrm{IDTFT}\{H_d\}$ (sinc for LPF). 3) Pick window shape from ripple spec, length from transition spec. 4) $h[n] = h_d[n]w[n]$. 5) Delay by $M$ for causality (linear phase).1) $\omega_c = 2\pi f_c/f_s$。2) $h_d[n] = \mathrm{IDTFT}\{H_d\}$(低通就是 sinc)。3) 由漣波規格挑視窗形狀,由過渡帶規格挑長度。4) $h[n] = h_d[n]w[n]$。5) 延遲 $M$ 以取得因果性(線性相位)。1) $\omega_c = 2\pi f_c/f_s$。2) $h_d[n] = \mathrm{IDTFT}\{H_d\}$(低域通過なら sinc)。3) リップル仕様から窓形状を、遷移幅仕様から長さを選ぶ。4) $h[n] = h_d[n]w[n]$。5) 因果性のために $M$ だけ遅らせる(線形位相)。

Least integral-squared error最小積分平方誤差最小積分二乗誤差

By Parseval, ISE-optimal length-$(2M+1)$ FIR = plain truncation of $h_d[n]$ to $|n| \le M$. Optimal in energy, terrible in worst case.依帕塞瓦爾定理,ISE 最佳的長度 $(2M+1)$ FIR =把 $h_d[n]$ 直接截斷到 $|n| \le M$。在能量上最佳,在最壞情況下慘不忍睹。パーセバルの定理により、ISE 最適な長さ $(2M+1)$ の FIR = $h_d[n]$ を $|n| \le M$ へ素朴に打ち切ったもの。エネルギーでは最適だが、最悪値ではひどい。

Gibbs phenomenonGibbs 現象ギブス現象

Truncation = × rectangular window = frequency-domain convolution with a periodic sinc. ~9% ears at discontinuities; longer filters narrow the ears but never shorten them. Not minimax-optimal.截斷=乘上矩形窗=在頻域與週期 sinc 做摺積。不連續處長出約 9% 的耳朵;加長濾波器只讓耳朵變窄,永遠不會變矮。在極大極小意義下並非最佳。打ち切り=矩形窓を掛けること=周波数領域で周期 sinc と畳み込むこと。不連続点に約 9% の耳が立つ。フィルタを長くしても耳は細くなるだけで低くはならない。ミニマックス最適ではない。

Window trade-off視窗的取捨窓のトレードオフ

Mainlobe width ($\propto 1/L$) → transition band. Sidelobe height (shape-determined, length-invariant) → ripple. Rect −21 dB, Hann −44, Hamming −53, Blackman −74 dB peak error.主瓣寬度($\propto 1/L$)→ 過渡帶。旁瓣高度(由形狀決定,與長度無關)→ 漣波。最大誤差:矩形 −21 dB、Hann −44、Hamming −53、Blackman −74 dB。主ローブ幅($\propto 1/L$)→ 遷移帯域。サイドローブの高さ(形状で決まり長さに依らない)→ リップル。最大誤差は矩形 −21 dB、Hann −44、Hamming −53、Blackman −74 dB。

Kaiser formulasKaiser 的公式カイザーの設計式

$w[n] = I_0\bigl(\beta\sqrt{1-(n/M)^2}\bigr)/I_0(\beta)$; $\beta$ from $\alpha$ (piecewise empirical fit), order $N \approx (\alpha-8)/(2.3\,\Delta\omega)$. One continuous knob replaces the window zoo.$w[n] = I_0\bigl(\beta\sqrt{1-(n/M)^2}\bigr)/I_0(\beta)$;$\beta$ 由 $\alpha$ 決定(分段的經驗配適),階數 $N \approx (\alpha-8)/(2.3\,\Delta\omega)$。一個連續的旋鈕就取代了一整座視窗動物園。$w[n] = I_0\bigl(\beta\sqrt{1-(n/M)^2}\bigr)/I_0(\beta)$。$\beta$ は $\alpha$ から決まり(区分的な経験式)、次数は $N \approx (\alpha-8)/(2.3\,\Delta\omega)$。連続したつまみ一つが窓の動物園を置き換える。

Equiripple & FIR vs IIR等漣波,以及 FIR 與 IIR等リップル、そして FIR 対 IIR

Parks–McClellan minimizes the max error ⇒ equiripple, fewest taps (44 vs Kaiser 63 on the benchmark). IIR (elliptic order 5) is still far cheaper, but FIR gives exact linear phase and unconditional stability.Parks–McClellan 把最大誤差最小化 ⇒ 等漣波、抽頭數最少(基準題上是 44,Kaiser 則要 63)。IIR(橢圓 5 階)仍然便宜得多,但 FIR 給得出精確的線性相位與無條件的穩定性。Parks–McClellan は最大誤差を最小にする ⇒ 等リップルで、タップ数が最少(ベンチマークでは 44、カイザーは 63)。IIR(楕円の 5 次)はなお圧倒的に安上がりだが、FIR は厳密な線形位相と無条件の安定性を与える。

Exercises習題演習問題

Exercise 1 — Optimal truncation in the ISE sense習題 1 — ISE 意義下的最佳截斷演習 1 — ISE の意味での最適な打ち切り

Problem: A desired frequency response $H_d(e^{j\omega})$ has ideal impulse response $h_d[n]$ (infinite extent). We seek the FIR filter $h_t[n]$, nonzero only for $-M \le n \le M$, that minimizes $\phi = \frac{1}{2\pi}\int_{-\pi}^{\pi} |H_d(e^{j\omega}) - H_t(e^{j\omega})|^2 d\omega$. (a) Show that the minimizer is $h_t[n] = h_d[n]$ for $|n| \le M$. (b) Give the residual (minimum) error. (c) Explain why this “best” filter can still have a large error at a single frequency.問題:某個想要的頻率響應 $H_d(e^{j\omega})$,其理想脈衝響應是 $h_d[n]$(無限長)。我們要找只在 $-M \le n \le M$ 上非零的 FIR 濾波器 $h_t[n]$,使 $\phi = \frac{1}{2\pi}\int_{-\pi}^{\pi} |H_d(e^{j\omega}) - H_t(e^{j\omega})|^2 d\omega$ 最小。(a) 證明最小解是在 $|n| \le M$ 上取 $h_t[n] = h_d[n]$。(b) 給出剩餘的(最小)誤差。(c) 說明為什麼這個「最佳」濾波器在單一頻率上仍可能有很大的誤差。問題:ある望みの周波数応答 $H_d(e^{j\omega})$ の理想インパルス応答は $h_d[n]$ である(無限に広がる)。$-M \le n \le M$ でのみ非零な FIR フィルタ $h_t[n]$ のうち、$\phi = \frac{1}{2\pi}\int_{-\pi}^{\pi} |H_d(e^{j\omega}) - H_t(e^{j\omega})|^2 d\omega$ を最小にするものを求めたい。(a) 最小解が $|n| \le M$ において $h_t[n] = h_d[n]$ となることを示せ。(b) 残る(最小の)誤差を与えよ。(c) この「最良」のフィルタが、ある一つの周波数では依然として大きな誤差をもちうる理由を説明せよ。

Click to reveal solution點擊展開解答クリックして解答を表示

(a) By Parseval’s theorem the cost equals the time-domain energy of the error:(a) 依帕塞瓦爾定理,這個代價等於誤差在時域的能量:(a) パーセバルの定理により、このコストは誤差の時間領域エネルギーに等しい:

$$\phi = \sum_{n=-\infty}^{\infty}\bigl|h_d[n]-h_t[n]\bigr|^2 = \sum_{n=-M}^{M}\bigl|h_d[n]-h_t[n]\bigr|^2 + \sum_{|n|>M}\bigl|h_d[n]\bigr|^2 .$$

Each term is nonnegative. The second sum does not depend on $h_t[n]$ at all (there $h_t[n]=0$ by constraint). The first sum is minimized — made exactly zero — by choosing $h_t[n] = h_d[n]$ on $-M \le n \le M$. Hence truncation is optimal.每一項都非負。第二個和式完全不依賴 $h_t[n]$(在那裡依限制有 $h_t[n]=0$)。第一個和式則在 $-M \le n \le M$ 上取 $h_t[n] = h_d[n]$ 時被最小化——而且剛好歸零。因此截斷是最佳的。各項は非負である。第二の和は $h_t[n]$ にまったく依存しない(そこでは制約により $h_t[n]=0$ である)。第一の和は $-M \le n \le M$ 上で $h_t[n] = h_d[n]$ と選ぶことで最小化され —— ちょうどゼロになる。よって打ち切りが最適である。

(b) The residual error is the energy of the discarded tail:(b) 剩餘誤差就是被丟掉的那條尾巴的能量:(b) 残る誤差は、捨てた裾のエネルギーである:

$$\phi_{\min} = \sum_{n < -M,\; n > M}\bigl|h_d[n]\bigr|^2 .$$

For the ideal LPF, $h_d[n] \sim 1/n$, so $\phi_{\min} \sim 1/M$: it decays, but slowly.對理想低通濾波器而言 $h_d[n] \sim 1/n$,所以 $\phi_{\min} \sim 1/M$:它會下降,但下降得很慢。理想低域通過フィルタでは $h_d[n] \sim 1/n$ なので $\phi_{\min} \sim 1/M$ である:減りはするが、ゆっくりである。

(c) The ISE is an integral criterion: it penalizes total error energy, not peak error. The error can concentrate into ever-narrower spikes near a discontinuity (Gibbs ears) whose energy → small while their height stays ≈ 9% of the jump. Minimizing ISE therefore says nothing about the worst-case (minimax) error.(c) ISE 是一個積分準則:它懲罰的是誤差的總能量,不是尖峰誤差。誤差可以集中成不連續點附近越來越窄的尖刺(Gibbs 耳朵),其能量 → 很小,但高度仍停在跳躍量的約 9%。所以把 ISE 最小化,對最壞情況(極大極小)誤差什麼也沒說。(c) ISE は積分的な基準である:罰するのは誤差の総エネルギーであって、ピーク誤差ではない。誤差は不連続点の近くでどんどん細いスパイク(ギブスの耳)に集中でき、そのエネルギーは → 小さくなる一方で、高さは跳び幅の約 9% のままである。したがって ISE を最小にしても、最悪値(ミニマックス)誤差については何も言えない。

Exercise 2 — Gibbs phenomenon (concept)習題 2 — Gibbs 現象(觀念)演習 2 — ギブス現象(概念)

Problem: A student designs a lowpass FIR by truncating the ideal sinc to 25 points and observes ~9% overshoot near the cutoff. To fix it, the student increases the length to 129 points. (a) What happens to the overshoot and why? (b) Express the truncated response $H_t(e^{j\omega})$ in terms of $H_d$ and the window spectrum. (c) Which property of $W_R(e^{j\omega})$ controls the transition width, and how does it scale with length? (d) What should the student change to reduce the overshoot?問題:有位學生把理想 sinc 截斷成 25 點來設計低通 FIR,發現截止頻率附近有約 9% 的過衝。為了修掉它,他把長度加到 129 點。(a) 過衝會怎麼變?為什麼?(b) 用 $H_d$ 與視窗頻譜把截斷後的響應 $H_t(e^{j\omega})$ 表示出來。(c) $W_R(e^{j\omega})$ 的哪一項性質控制過渡帶寬度?它如何隨長度縮放?(d) 這位學生應該改什麼,才能把過衝壓小?問題:ある学生が理想 sinc を 25 点に打ち切って低域通過 FIR を設計し、遮断周波数付近に約 9% のオーバーシュートを見つけた。直そうとして長さを 129 点に増やした。(a) オーバーシュートはどうなるか、またなぜか。(b) 打ち切った応答 $H_t(e^{j\omega})$ を $H_d$ と窓のスペクトルで表せ。(c) $W_R(e^{j\omega})$ のどの性質が遷移幅を決め、それは長さとともにどうスケールするか。(d) オーバーシュートを減らすには、この学生は何を変えるべきか。

Click to reveal solution點擊展開解答クリックして解答を表示

(a) The overshoot height stays ≈ 9% — the ears only get narrower. The relative sidelobe level of the rectangular window (−13 dB) is essentially independent of its length, and the overshoot is set by the integrated sidelobes, not by $N$.(a) 過衝高度仍停在約 9%——耳朵只是變窄。矩形窗的相對旁瓣位準(−13 dB)基本上與長度無關,而過衝是由旁瓣的積分決定,不是由 $N$ 決定。(a) オーバーシュートの高さは約 9% のままで、耳が細くなるだけである。矩形窓の相対サイドローブ準位(−13 dB)は長さにほとんど依存せず、オーバーシュートはサイドローブの積分で決まるのであって $N$ で決まるのではない。

(b) Truncation is multiplication by $w_R[n]$, so by the modulation theorem(b) 截斷就是乘上 $w_R[n]$,所以依調變定理(b) 打ち切りは $w_R[n]$ を掛けることなので、変調定理により

$$H_t(e^{j\omega}) = \frac{1}{2\pi}\int_{-\pi}^{\pi} H_d(e^{j\theta})\, W_R\!\left(e^{j(\omega-\theta)}\right) d\theta , \qquad W_R(e^{j\omega}) = \frac{\sin\bigl((2M+1)\omega/2\bigr)}{\sin(\omega/2)} .$$

(c) The mainlobe width, $4\pi/(2M+1)$ between zero crossings: it shrinks as $1/$length, so the transition band sharpens as the filter lengthens.(c) 主瓣寬度,也就是零交越之間的 $4\pi/(2M+1)$:它以 $1/$長度 的方式縮小,所以濾波器越長,過渡帶就越陡。(c) 主ローブ幅、すなわち零交差のあいだの $4\pi/(2M+1)$ である。これは $1/$長さ で縮むので、フィルタが長いほど遷移帯域は急になる。

(d) Change the window shape, not (only) the length: use a tapered window (Hann/Hamming/Blackman) or a Kaiser window with $\beta$ chosen from the required attenuation. Lower sidelobes ⇒ smaller ripples/overshoot, at the price of a wider mainlobe (longer filter for the same transition width).(d) 要改的是視窗的形狀,而不是(只有)長度:改用漸變窗(Hann/Hamming/Blackman),或用 $\beta$ 由所需衰減決定的 Kaiser 視窗。旁瓣更低 ⇒ 漣波與過衝更小,代價是主瓣更寬(同樣的過渡帶寬度要用更長的濾波器)。(d) 変えるべきは窓の形状であって、長さ(だけ)ではない:先細りの窓(Hann/Hamming/Blackman)を使うか、必要な減衰量から $\beta$ を決めたカイザー窓を使う。サイドローブが低い ⇒ リップルとオーバーシュートは小さくなるが、代わりに主ローブが広くなる(同じ遷移幅ならフィルタは長くなる)。

Exercise 3 — Windowed-sinc lowpass design習題 3 — 加窗 sinc 低通設計演習 3 — 窓かけ sinc による低域通過設計

Problem: Design a 33-point linear-phase FIR low-pass filter with cutoff 1 kHz for a system sampled at 8 kHz, using a Hann window. (a) Find $\omega_c$. (b) Write the closed-form $h[n]$ (noncausal form) and state the causal shift. (c) Using the comparison table, estimate the stopband attenuation and the transition width. (d) What is the group delay in samples and in milliseconds?問題:為一個以 8 kHz 取樣的系統,用 Hann 視窗設計一個 33 點、線性相位、截止頻率 1 kHz 的 FIR 低通濾波器。(a) 求 $\omega_c$。(b) 寫出閉合形式的 $h[n]$(非因果形式),並說明因果位移。(c) 用比較表估計阻帶衰減與過渡帶寬度。(d) 群延遲是多少個樣本、多少毫秒?問題:標本化周波数 8 kHz のシステム向けに、Hann 窓を使って遮断周波数 1 kHz の 33 点線形位相 FIR 低域通過フィルタを設計せよ。(a) $\omega_c$ を求めよ。(b) 閉じた形の $h[n]$(非因果形)を書き、因果にするシフトを述べよ。(c) 比較表を使って阻止帯域減衰量と遷移幅を見積もれ。(d) 群遅延は何標本で、何ミリ秒か。

Click to reveal solution點擊展開解答クリックして解答を表示

(a) $\displaystyle \omega_c = \frac{1000}{8000}\times 2\pi = 0.25\pi$ rad/sample.(a) $\displaystyle \omega_c = \frac{1000}{8000}\times 2\pi = 0.25\pi$ 弧度/樣本。(a) $\displaystyle \omega_c = \frac{1000}{8000}\times 2\pi = 0.25\pi$ rad/sample である。

(b) $N = 33 = 2M+1 \Rightarrow M = 16$. With the slide convention:(b) $N = 33 = 2M+1 \Rightarrow M = 16$。採用投影片的慣例:(b) $N = 33 = 2M+1 \Rightarrow M = 16$。スライドの規約に従うと:

$$h[n] = \frac{\sin 0.25\pi n}{\pi n}\left(0.5 + 0.5\cos\frac{2\pi n}{33}\right), \qquad -16 \le n \le 16,$$

with $h[0] = \omega_c/\pi = 0.25$. Delay by $M = 16$ samples: $\hat h[n] = h[n-16]$, $0 \le n \le 32$.其中 $h[0] = \omega_c/\pi = 0.25$。延遲 $M = 16$ 個樣本:$\hat h[n] = h[n-16]$,$0 \le n \le 32$。ここで $h[0] = \omega_c/\pi = 0.25$ である。$M = 16$ 標本遅らせると $\hat h[n] = h[n-16]$、$0 \le n \le 32$ となる。

(c) Hann window: peak approximation error $\approx -44$ dB ⇒ stopband attenuation ≈ 44 dB (and passband ripple $\delta_p = \delta_s \approx 10^{-44/20} \approx 0.0063$). Transition width (table, order $M_{\text{ord}} = 32$): $\Delta\omega \approx 8\pi/32 = 0.25\pi$ rad/sample, i.e. about $0.25\pi/(2\pi)\times 8000 = 1$ kHz.(c) Hann 窗:最大逼近誤差 $\approx -44$ dB ⇒ 阻帶衰減約 44 dB(通帶漣波則為 $\delta_p = \delta_s \approx 10^{-44/20} \approx 0.0063$)。過渡帶寬度(查表,階數 $M_{\text{ord}} = 32$):$\Delta\omega \approx 8\pi/32 = 0.25\pi$ 弧度/樣本,也就是約 $0.25\pi/(2\pi)\times 8000 = 1$ kHz。(c) Hann 窓:最大近似誤差 $\approx -44$ dB ⇒ 阻止帯域減衰量は約 44 dB(通過帯域リップルは $\delta_p = \delta_s \approx 10^{-44/20} \approx 0.0063$)。遷移幅(表より、次数 $M_{\text{ord}} = 32$):$\Delta\omega \approx 8\pi/32 = 0.25\pi$ rad/sample、すなわち約 $0.25\pi/(2\pi)\times 8000 = 1$ kHz である。

(d) Linear phase with symmetric $h[n]$: group delay $= M = 16$ samples $= 16/8000 = 2$ ms.(d) 對稱的 $h[n]$ 給出線性相位:群延遲 $= M = 16$ 個樣本 $= 16/8000 = 2$ 毫秒。(d) 対称な $h[n]$ による線形位相:群遅延は $= M = 16$ 標本 $= 16/8000 = 2$ ms である。

Exercise 4 — Kaiser window sizing from a spec習題 4 — 由規格決定 Kaiser 視窗的尺寸演習 4 — 仕様からカイザー窓の大きさを決める

Problem: A lowpass filter must satisfy: passband edge $\omega_p = 0.22\pi$, stopband edge $\omega_s = 0.29\pi$, minimum stopband attenuation $\alpha = 40$ dB. Using Kaiser’s empirical formulas, find (a) the ripple $\delta$, (b) the shape parameter $\beta$, (c) the required order $N$, and (d) the cutoff $\omega_c$ you would hand to the ideal-sinc prototype.問題:某個低通濾波器必須滿足:通帶邊界 $\omega_p = 0.22\pi$、阻帶邊界 $\omega_s = 0.29\pi$、最小阻帶衰減 $\alpha = 40$ dB。用 Kaiser 的經驗公式求 (a) 漣波 $\delta$、(b) 形狀參數 $\beta$、(c) 所需階數 $N$,以及 (d) 你會交給理想 sinc 原型的截止頻率 $\omega_c$。問題:ある低域通過フィルタは次を満たさなければならない:通過帯域端 $\omega_p = 0.22\pi$、阻止帯域端 $\omega_s = 0.29\pi$、最小阻止帯域減衰量 $\alpha = 40$ dB。カイザーの経験式を用いて、(a) リップル $\delta$、(b) 形状パラメータ $\beta$、(c) 必要な次数 $N$、(d) 理想 sinc プロトタイプに渡す遮断周波数 $\omega_c$ を求めよ。

Click to reveal solution點擊展開解答クリックして解答を表示

(a) $\delta = 10^{-\alpha/20} = 10^{-2} = 0.01$ (window methods force $\delta_p = \delta_s = \delta$).(a) $\delta = 10^{-\alpha/20} = 10^{-2} = 0.01$(視窗法強制 $\delta_p = \delta_s = \delta$)。(a) $\delta = 10^{-\alpha/20} = 10^{-2} = 0.01$(窓関数法は $\delta_p = \delta_s = \delta$ を強制する)。

(b) $21 \le \alpha \le 50$, so(b) $21 \le \alpha \le 50$,所以(b) $21 \le \alpha \le 50$ なので

$$\beta = 0.5842\,(40-21)^{0.4} + 0.07886\,(40-21) = 0.5842(19)^{0.4} + 0.07886 \times 19 \approx 1.897 + 1.498 \approx 3.40 .$$

(c) $\Delta\omega = \omega_s - \omega_p = 0.07\pi \approx 0.2199$ rad. Then(c) $\Delta\omega = \omega_s - \omega_p = 0.07\pi \approx 0.2199$ 弧度。於是(c) $\Delta\omega = \omega_s - \omega_p = 0.07\pi \approx 0.2199$ rad である。したがって

$$N \approx \frac{\alpha - 8}{2.3\,\Delta\omega} = \frac{32}{2.3 \times 0.2199} \approx 63.3 \;\Rightarrow\; N = 63 \text{ (order)},$$

i.e. 64 taps — matching the “Kaiser: 63” row of Table 7.3 (the slides’ benchmark). (With O&S’s constant 2.285 the estimate is 63.7; tools like kaiserord round up and may return 64–65 taps.)也就是 64 個抽頭——與表 7.3「Kaiser:63」那一列(投影片的基準題)相符。(若用 O&S 的常數 2.285,估出來是 63.7;像 kaiserord 這類工具會向上取整,可能回傳 64–65 個抽頭。)すなわち 64 タップであり、表 7.3 の「Kaiser:63」の行(スライドのベンチマーク)と一致する。(O&S の定数 2.285 を使えば見積りは 63.7 である。kaiserord のようなツールは切り上げるので 64–65 タップを返すことがある。)

(d) Center the transition band: $\omega_c = (\omega_p + \omega_s)/2 = 0.255\pi$.(d) 把過渡帶置中:$\omega_c = (\omega_p + \omega_s)/2 = 0.255\pi$。(d) 遷移帯域の中央に置く:$\omega_c = (\omega_p + \omega_s)/2 = 0.255\pi$。

Exercise 5 — Frequency-response arithmetic習題 5 — 頻率響應的加減運算演習 5 — 周波数応答の算術

Problem: Using only ideal-lowpass building blocks $h_{LP}[n;\omega_c] = \sin(\omega_c n)/(\pi n)$ and the allpass $\delta[n]$, find the ideal impulse responses of (a) a highpass filter with cutoff $\omega_c$, (b) a bandpass filter with band $\omega_1 < |\omega| < \omega_2$, and (c) a bandstop filter that rejects $\omega_1 < |\omega| < \omega_2$. (d) State the property of the ideal responses that makes this arithmetic legal, and what you must not do before combining them.問題:只用理想低通的積木 $h_{LP}[n;\omega_c] = \sin(\omega_c n)/(\pi n)$ 與全通的 $\delta[n]$,求出 (a) 截止頻率為 $\omega_c$ 的高通濾波器、(b) 通帶為 $\omega_1 < |\omega| < \omega_2$ 的帶通濾波器,以及 (c) 阻掉 $\omega_1 < |\omega| < \omega_2$ 的帶阻濾波器的理想脈衝響應。(d) 說明理想響應的哪一項性質讓這種加減運算合法,以及在把它們組合起來之前你絕不能做什麼。問題:理想低域通過のブロック $h_{LP}[n;\omega_c] = \sin(\omega_c n)/(\pi n)$ と全域通過の $\delta[n]$ だけを使って、(a) 遮断周波数 $\omega_c$ の高域通過フィルタ、(b) 帯域が $\omega_1 < |\omega| < \omega_2$ の帯域通過フィルタ、(c) $\omega_1 < |\omega| < \omega_2$ を阻止する帯域阻止フィルタの理想インパルス応答を求めよ。(d) この算術を正当なものにしている理想応答の性質と、組み合わせる前にやってはいけないことを述べよ。

Click to reveal solution點擊展開解答クリックして解答を表示

All ideal responses here are pure real (zero phase), so magnitudes add/subtract directly.這裡所有的理想響應都是純實數(零相位)的,所以大小響應可以直接相加相減。ここでの理想応答はすべて純実数(ゼロ位相)なので、振幅をそのまま足し引きできる。

(a) $H_{HP} = 1 - H_{LP}(\omega_c)$:

$$h_{HP}[n] = \delta[n] - \frac{\sin \omega_c n}{\pi n}$$

(b) $H_{BP} = H_{LP}(\omega_2) - H_{LP}(\omega_1)$:

$$h_{BP}[n] = \frac{\sin \omega_2 n}{\pi n} - \frac{\sin \omega_1 n}{\pi n}$$

(c) $H_{BS} = 1 - H_{BP}$:

$$h_{BS}[n] = \delta[n] - \frac{\sin \omega_2 n}{\pi n} + \frac{\sin \omega_1 n}{\pi n}$$

(d) Legality rests on $\theta(\omega) = 0$ for every block, so that $H_1 \pm H_2$ manipulates the magnitudes themselves; with nonzero (e.g. different linear) phases, $|H_1 \pm H_2| \neq |H_1| \pm |H_2|$ and the brick walls would be destroyed. Therefore: do not apply the causal delay to the individual blocks first — combine the zero-phase responses, window the result, and delay once at the very end. (Windowing the combination with $w[n]$ then delaying by $M$ keeps everything consistent because all blocks share the same window and the same delay.)(d) 合法性建立在每一塊積木都有 $\theta(\omega) = 0$ 之上,這樣 $H_1 \pm H_2$ 操作到的才是大小響應本身;若相位不為零(例如各自帶著不同的線性相位),就會有 $|H_1 \pm H_2| \neq |H_1| \pm |H_2|$,磚牆也就毀了。所以:不要先對個別積木套上因果延遲——先把零相位的響應組合起來,對結果加窗,最後才一次延遲。(先用 $w[n]$ 對組合結果加窗、再延遲 $M$,一切都會一致,因為所有積木共用同一個視窗與同一個延遲。)(d) 正当性はどのブロックでも $\theta(\omega) = 0$ であることに依っており、それゆえ $H_1 \pm H_2$ は振幅そのものを操作する。位相が非零であれば(たとえばそれぞれ異なる線形位相をもてば)$|H_1 \pm H_2| \neq |H_1| \pm |H_2|$ となり、レンガ壁は壊れてしまう。したがって、個々のブロックに先に因果遅延を掛けてはいけない —— ゼロ位相の応答を組み合わせ、その結果に窓を掛け、最後に一度だけ遅らせる。(組み合わせた結果に $w[n]$ を掛けてから $M$ だけ遅らせれば、すべてのブロックが同じ窓と同じ遅延を共有するので整合が保たれる。)

Exercise 6 — MATLAB: Kaiser design with kaiserord / fir1習題 6 — MATLAB:用 kaiserord / fir1 做 Kaiser 設計演習 6 — MATLAB:kaiserord / fir1 によるカイザー窓設計

Problem: Implement the benchmark spec of §14.6.2 in MATLAB: $\omega_p = 0.22\pi$, $\omega_s = 0.29\pi$, passband ripple $\le 1$ dB, stopband attenuation $\ge 40$ dB. Use kaiserord + fir1 to design the filter, plot the magnitude response in dB against the spec mask, and compare the resulting number of taps with a Parks–McClellan design from firpmord/firpm.問題:在 MATLAB 裡實作 §14.6.2 的基準規格:$\omega_p = 0.22\pi$、$\omega_s = 0.29\pi$、通帶漣波 $\le 1$ dB、阻帶衰減 $\ge 40$ dB。用 kaiserord 加 fir1 設計這個濾波器,把 dB 大小響應對著規格遮罩畫出來,再把得到的抽頭數與 firpmord/firpm 的 Parks–McClellan 設計做比較。問題:§14.6.2 のベンチマーク仕様を MATLAB で実装せよ:$\omega_p = 0.22\pi$、$\omega_s = 0.29\pi$、通過帯域リップル $\le 1$ dB、阻止帯域減衰量 $\ge 40$ dB。kaiserord と fir1 でフィルタを設計し、dB 表示の振幅応答を仕様マスクと重ねて描き、得られたタップ数を firpmord/firpm による Parks–McClellan 設計と比較せよ。

Click to reveal solution點擊展開解答クリックして解答を表示

Convert the dB spec into linear ripples first ($1$ dB passband ⇒ $\delta_p = (10^{1/20}-1)/(10^{1/20}+1) \approx 0.0575$; $-40$ dB ⇒ $\delta_s = 0.01$). Frequencies for fir1/kaiserord are normalized to the Nyquist frequency (1 corresponds to $\pi$):先把 dB 規格換算成線性漣波(通帶 $1$ dB ⇒ $\delta_p = (10^{1/20}-1)/(10^{1/20}+1) \approx 0.0575$;$-40$ dB ⇒ $\delta_s = 0.01$)。給 fir1/kaiserord 的頻率,是對奈奎斯特頻率正規化過的(1 對應 $\pi$):まず dB 仕様を線形のリップルへ換算する(通過帯域 $1$ dB ⇒ $\delta_p = (10^{1/20}-1)/(10^{1/20}+1) \approx 0.0575$、$-40$ dB ⇒ $\delta_s = 0.01$)。fir1/kaiserord に渡す周波数はナイキスト周波数で正規化されている(1 が $\pi$ に対応する):

% spec: wp = 0.22*pi, ws = 0.29*pi, Rp = 1 dB, As = 40 dB
dp = (10^(1/20)-1)/(10^(1/20)+1);     % 1 dB passband -> delta_p = 0.0575
ds = 10^(-40/20);                     % 40 dB stopband -> delta_s = 0.01

% --- Kaiser window design ---
[n, Wn, beta, ftype] = kaiserord([0.22 0.29], [1 0], [dp ds]);
hK = fir1(n, Wn, ftype, kaiser(n+1, beta), 'noscale');
fprintf('Kaiser: %d taps, beta = %.3f\n', n+1, beta);

% --- Parks-McClellan for comparison ---
[n2, fo, ao, w] = firpmord([0.22 0.29], [1 0], [dp ds]);
hPM = firpm(n2, fo, ao, w);
fprintf('Parks-McClellan: %d taps\n', n2+1);

% --- plot against the spec mask ---
[H, wfr] = freqz(hK, 1, 4096);
plot(wfr/pi, 20*log10(abs(H))); hold on; grid on;
plot([0.29 1], [-40 -40], 'k--', [0 0.22], [-1 -1], 'k--');
xlabel('\omega/\pi'); ylabel('|H| (dB)');
title('Kaiser windowed FIR vs. spec');

Result: kaiserord returns $\beta \approx 3.40$ (matching Exercise 4) and ≈ 64–65 taps; firpmord/firpm meets the same spec with ≈ 45 taps (order 44, Table 7.3) — the equiripple design saves roughly 20 taps. The regenerated result (Python/scipy, signal.kaiserord(40, 0.07) ⇒ 65 taps, $\beta = 3.395$, signal.firwin cutoff $0.255\pi$):結果:kaiserord 回傳 $\beta \approx 3.40$(與習題 4 相符)以及約 64–65 個抽頭;firpmord/firpm 用約 45 個抽頭(階數 44,表 7.3)就滿足同一份規格——等漣波設計省下大約 20 個抽頭。重新產生的結果(Python/scipy,signal.kaiserord(40, 0.07) ⇒ 65 個抽頭、$\beta = 3.395$、signal.firwin 截止頻率 $0.255\pi$):結果:kaiserord は $\beta \approx 3.40$(演習 4 と一致)と約 64–65 タップを返す。firpmord/firpm は同じ仕様を約 45 タップ(次数 44、表 7.3)で満たす —— 等リップル設計はおよそ 20 タップを節約する。再生成した結果(Python/scipy、signal.kaiserord(40, 0.07) ⇒ 65 タップ、$\beta = 3.395$、signal.firwin の遮断周波数 $0.255\pi$):

2026-06-12T22:40:41.016901 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 omega/pi −80 −60 −40 −20 0 dB Kaiser design, 65 taps: full band 0.00 0.05 0.10 0.15 0.20 0.25 0.30 omega/pi −2.0 −1.5 −1.0 −0.5 0.0 0.5 1.0 1.5 2.0 Passband zoom: ripple << 1 dB
Exercise 6 figure — Kaiser design (65 taps): the full-band response just touches the −40 dB stopband line; the passband zoom shows ripple far below the 1 dB allowance — the “overdesign” of window methods ($\delta_p = \delta_s$) in action.(窗法強制 $\delta_p=\delta_s$,通帶因此被「過度設計」)習題 6 附圖 — Kaiser 設計(65 個抽頭):全頻帶響應剛好貼到 −40 dB 的阻帶線;通帶放大圖則顯示漣波遠低於 1 dB 的容許值。這就是視窗法「過度設計」($\delta_p = \delta_s$)的現場:窗法強制 $\delta_p=\delta_s$,通帶因此被過度設計。演習 6 の図 — カイザー設計(65 タップ):全帯域の応答は −40 dB の阻止帯域線にちょうど接し、通過帯域の拡大図ではリップルが 1 dB の許容値よりはるかに下にある。窓関数法の「過剰設計」($\delta_p = \delta_s$)が働いている実例である:窓関数法は $\delta_p=\delta_s$ を強制するので、通過帯域が過剰に設計されてしまう。