A digital filter(數位濾波器)is an LTI system designed to pass certain frequency components of a signal and attenuate(衰減)others. Because an LTI system simply multiplies each frequency component by its frequency response, the whole story of filtering is contained in數位濾波器是一種 LTI 系統,設計目的是讓訊號中某些頻率成分通過,並把其餘成分衰減掉。由於 LTI 系統只是把每個頻率成分乘上自己的頻率響應,濾波的全部內容其實都包含在下式之中:ディジタルフィルタとは、信号の特定の周波数成分を通過させ、それ以外を減衰させるように設計された LTI システムである。LTI システムは各周波数成分にその周波数応答を掛けるだけなので、フィルタリングの内容はすべて次の式に収まっている。
Frequencies where $|H(e^{j\omega})| \approx 1$ form the passband(通帶); frequencies where $|H(e^{j\omega})| \approx 0$ form the stopband(阻帶). This chapter introduces the simplest members of the two great families of realizable filters:使 $|H(e^{j\omega})| \approx 1$ 的頻率構成通帶;使 $|H(e^{j\omega})| \approx 0$ 的頻率構成阻帶。本章介紹兩大可實現濾波器家族中最簡單的成員:$|H(e^{j\omega})| \approx 1$ となる周波数が通過帯域を、$|H(e^{j\omega})| \approx 0$ となる周波数が阻止帯域を作る。本章では、実現可能なフィルタの二大系統のうち最も単純なものを紹介する。
| FIR (Finite Impulse Response, 有限脈衝響應)FIR(有限脈衝響應)FIR(有限インパルス応答) | IIR (Infinite Impulse Response, 無限脈衝響應)IIR(無限脈衝響應)IIR(無限インパルス応答) | |
|---|---|---|
| Difference equation差分方程式差分方程式 | $y[n]=\sum_{k=0}^{M} b_k\,x[n-k]$ (no feedback)$y[n]=\sum_{k=0}^{M} b_k\,x[n-k]$(無回授)$y[n]=\sum_{k=0}^{M} b_k\,x[n-k]$(帰還なし) | $y[n]=\sum_{k=0}^{M} b_k x[n-k]-\sum_{k=1}^{N} a_k y[n-k]$ (feedback)$y[n]=\sum_{k=0}^{M} b_k x[n-k]-\sum_{k=1}^{N} a_k y[n-k]$(有回授)$y[n]=\sum_{k=0}^{M} b_k x[n-k]-\sum_{k=1}^{N} a_k y[n-k]$(帰還あり) |
| Impulse response脈衝響應インパルス応答 | finite length長度有限長さが有限 | infinite length長度無限長さが無限 |
| Poles極點極 | only at $z=0$ — always stable只在 $z=0$ — 必定穩定$z=0$ のみ — 常に安定 | anywhere; stable iff poles inside unit circle可以在任何位置;唯有極點全在單位圓內才穩定どこにでも置ける。極がすべて単位円の内側にあるときに限り安定 |
| Exact linear phase嚴格的線性相位厳密な線形位相 | possible (Section 11.6)可以做到(11.6 節)可能(11.6 節) | not possible (only approximately)做不到(只能近似)不可能(近似のみ) |
| Order needed for sharp cutoff達成陡峭截止所需的階數急峻な遮断に必要な次数 | high高高い | low低低い |
The table above splits filters into two families and asserts that three statements say the same thing: the length of the impulse response ⇔ whether the block diagram carries feedback ⇔ whether $H(z)$ has poles. The three are tied together because each is a different reading of the same difference equation.上表把濾波器分成兩大類,並指出三種說法是等價的:脈衝響應長度 ⇔ 方塊圖有沒有回授 ⇔ $H(z)$ 有沒有極點。三者之所以綁在一起,是因為它們不過是同一條差分方程式的三種讀法。上の表はフィルタを二つの系統に分け、三つの言い方が同じことを述べていると主張する。すなわちインパルス応答の長さ ⇔ ブロック図に帰還があるか ⇔ $H(z)$ に極があるかである。この三つが結びついているのは、どれも同じ差分方程式の読み方の違いにすぎないからである。
An FIR output is a weighted sum of the present and past inputs only:FIR 的輸出只由現在和過去的輸入加權相加:FIR の出力は現在と過去の入力だけの重みつき和である。
Why is the impulse response finite? Feed in a single impulse $\delta[n]$ and the output is the coefficient list: $h[n] = b_n$. After $M$ samples the impulse has walked out of the delay line and the output drops to 0 at once.為什麼脈衝響應是有限的?輸入一個脈衝 $\delta[n]$,輸出就是係數本身:$h[n] = b_n$。$M$ 個樣本之後,脈衝已經「走出」延遲線,輸出立刻變成 0。なぜインパルス応答は有限なのか。インパルス $\delta[n]$ を一つ入れると、出力は係数そのものになる。$h[n] = b_n$ である。$M$ 標本のあとインパルスは遅延線を「出て」しまい、出力はただちに 0 になる。
Why is there no feedback? In the block diagram the input is delayed, scaled by the coefficients and summed; the output never travels back to the input side. The 3-point filter $\{\alpha,\ \beta,\ \alpha\}$ of §10.2.5 is exactly this structure.為什麼沒有回授?方塊圖中只有輸入經過延遲、乘上係數、相加,輸出從不回到輸入端。§10.2.5 的 3 點濾波器 $\{\alpha,\ \beta,\ \alpha\}$ 就是這種結構。なぜ帰還がないのか。ブロック図では入力が遅延し、係数を掛けられ、加算されるだけで、出力が入力側へ戻ることは決してない。§10.2.5 の 3 点フィルタ $\{\alpha,\ \beta,\ \alpha\}$ がまさにこの構造である。
Why are there no poles? The z-transform is a polynomial in $z^{-1}$:為什麼沒有極點?Z 轉換是 $z^{-1}$ 的多項式:なぜ極がないのか。z 変換は $z^{-1}$ の多項式である。
The roots of the numerator are the zeros and may be placed anywhere; the denominator is nothing but $z^M$, so every "pole" sits at the origin. A pole at the origin does not affect the magnitude response at all — its distance to the unit circle is always 1 — and contributes only linear phase, that is, a pure delay. So when the slide says "no poles", what it means precisely is no poles anywhere but the origin. The 3-point filter is the case with zeros at $e^{\pm j0.4}$ and a double pole at the origin.分子的根是零點,可以放在任何位置;分母只有 $z^M$,所以「極點」全部在原點。原點的極點不影響大小響應(距離單位圓永遠是 1),只貢獻線性相位(純延遲)。因此投影片說「no poles」,精確的意思是沒有原點以外的極點。3 點濾波器就是零點在 $e^{\pm j0.4}$、原點有二重極點。分子の根が零点であり、どこにでも置ける。分母は $z^M$ でしかないので、「極」はすべて原点にある。原点の極は振幅応答にまったく影響しない。単位円までの距離がつねに 1 だからである。寄与するのは線形位相、すなわち純粋な遅延だけである。したがってスライドの「no poles」が正確に意味するのは、原点以外に極がないということである。3 点フィルタは零点が $e^{\pm j0.4}$ にあり、原点に二重極をもつ場合にあたる。
An IIR output uses the past outputs as well as the inputs:IIR 的輸出除了輸入,還用到過去的輸出:IIR の出力は入力に加えて過去の出力も使う。
Why is the impulse response infinite? Take the simplest first-order system:為什麼脈衝響應是無限的?以最簡單的一階系統為例:なぜインパルス応答は無限なのか。最も単純な 1 次のシステムで考える。
Once the impulse is in, the output is sent back, multiplied by $a$, and sent back again, and again — it never becomes exactly 0. It only decays exponentially ($|a| < 1$) or blows up ($|a| > 1$).脈衝進來後,輸出被送回去乘上 $a$,再送回去……永遠不會精確變成 0,只會指數衰減($|a| < 1$)或發散($|a| > 1$)。インパルスが入ると、出力は戻されて $a$ を掛けられ、また戻され……と続き、決して厳密に 0 にはならない。指数的に減衰する($|a| < 1$)か、発散する($|a| > 1$)だけである。
Why are there poles? The z-transform becomes a rational function:為什麼有極點?Z 轉換變成有理函數:なぜ極があるのか。z 変換は有理関数になる。
The roots of the denominator $A(z)$ are the poles, and they come straight from the feedback coefficients $a_k$. For the first-order example above, $H(z) = \dfrac{1}{1 - az^{-1}}$ and the pole sits at $z = a$. The allpass filter of §10.4.1 and the system of the lecture example in §10.3.3 are both IIR.分母 $A(z)$ 的根就是極點,直接來自回授係數 $a_k$。上面的一階例子:$H(z) = \dfrac{1}{1 - az^{-1}}$,極點在 $z = a$。§10.4.1 用過的全通濾波器、§10.3.3 課本例子中的系統,都是 IIR。分母 $A(z)$ の根が極であり、それは帰還係数 $a_k$ から直接生じる。上の 1 次の例では $H(z) = \dfrac{1}{1 - az^{-1}}$ であり、極は $z = a$ にある。§10.4.1 の全域通過フィルタも、§10.3.3 の講義例のシステムも、どちらも IIR である。
| FIR | IIR | |
|---|---|---|
| Difference equation差分方程式差分方程式 | $x$ terms only只有 $x$ 項$x$ の項のみ | past values of $y$ as well有 $y$ 的過去值$y$ の過去の値も使う |
| Block diagram方塊圖ブロック図 | feed-forward only只有前饋前向きの経路のみ | a feedback path有回授路徑帰還の経路がある |
| $H(z)$ | polynomial (poles only at the origin)多項式(極點只在原點)多項式(極は原点のみ) | rational (poles away from the origin)有理函數(原點以外有極點)有理関数(原点以外に極がある) |
| $h[n]$ | finite length有限長度有限の長さ | infinite length無限長度無限の長さ |
The interactive figure below carries four systems, and shows the difference equation, the pole-zero plot, the impulse response and the magnitude response of each at the same time.下面的互動圖有四種系統,可以同時看到差分方程式、pole-zero 圖、脈衝響應和大小響應。下のインタラクティブな図には四つのシステムがあり、差分方程式、極零配置、インパルス応答、振幅応答を同時に見ることができる。
FIR: moving average. Adjust $N$ and the impulse response is exactly $N$ stems of equal height, every later sample being 0. In the pole-zero plot the zeros are spread evenly around the unit circle and the poles are all piled at the origin. Whatever $N$ is, the stability reading stays "stable".FIR:移動平均。調整 $N$,脈衝響應恰好是 $N$ 根等高的線,之後全部是 0。pole-zero 圖中,零點均勻分布在單位圓上,極點全部集中在原點。不論 $N$ 是多少,穩定性永遠是「穩定」。FIR:移動平均。$N$ を動かすと、インパルス応答はちょうど $N$ 本の等しい高さの棒になり、それ以降はすべて 0 である。極零配置では零点が単位円上に等間隔に並び、極はすべて原点に集まる。$N$ がいくつであっても、安定性の表示は「安定」のままである。
IIR: first order. Pull $a$ from 0.5 up to 0.95 and the "tail" of the impulse response grows ever longer, because the closer the pole comes to the unit circle the slower the decay (a time constant of about $1/(1-|a|)$). For negative $a$ the samples of $h[n]$ alternate in sign. Push $a$ past 1 and the pole leaves the unit circle, whereupon the impulse response diverges.IIR:一階。把 $a$ 從 0.5 拉到 0.95,脈衝響應的「尾巴」越來越長,因為極點越靠近單位圓,衰減越慢(時間常數約 $1/(1-|a|)$)。$a$ 為負數時,$h[n]$ 正負交錯。把 $a$ 拉過 1,極點跑出單位圓,脈衝響應發散。IIR:1 次。$a$ を 0.5 から 0.95 へ上げると、インパルス応答の「尾」はしだいに長くなる。極が単位円に近づくほど減衰が遅くなるからである(時定数はおよそ $1/(1-|a|)$)。$a$ が負のとき $h[n]$ は符号が交互になる。$a$ を 1 より大きくすると極は単位円の外へ出て、インパルス応答は発散する。
IIR: second-order resonator. This is the pole structure used by the allpass filter and by the lecture example of §10.3.3. The impulse response is a decaying oscillation — the ringing met earlier. The closer $\rho$ comes to 1, the longer the ringing lasts and the sharper the peak of the frequency response. This is precisely the time-domain face of "the closer a pole comes to the unit circle, the larger the group delay and the longer the transient".IIR:二階共振。這就是全通濾波器和 §10.3.3 課本例子中使用的極點結構。脈衝響應是衰減振盪,也就是先前提到的振鈴。$\rho$ 越接近 1,振鈴越久,頻率響應的峰值越尖銳。這正是「極點越靠近單位圓,群延遲越大、暫態越長」的時域表現。IIR:2 次の共振。これは全域通過フィルタと §10.3.3 の講義例で使われている極の構造である。インパルス応答は減衰振動、すなわち先に出てきたリンギングである。$\rho$ が 1 に近づくほどリンギングは長く続き、周波数応答のピークは鋭くなる。これこそ「極が単位円に近づくほど群遅延は大きく、過渡は長くなる」ことの時間領域での姿である。
Recursive moving average. This mode brings out a detail hidden in the "⇔" of the slide. Its difference equation contains $y[n-1]$ and its block diagram does carry feedback, yet its impulse response has only $N$ nonzero samples — exactly as in mode 1.遞迴移動平均。這個模式說明投影片中「⇔」的一個細節。它的差分方程式有 $y[n-1]$,方塊圖有回授,但脈衝響應只有 $N$ 個非零樣本,和模式 1 完全相同。再帰的移動平均。このモードはスライドの「⇔」に隠れた細部を明らかにする。差分方程式には $y[n-1]$ があり、ブロック図には帰還がある。それでもインパルス応答の非零標本は$N$ 個だけで、モード 1 とまったく同じである。
The reason is that the pole at $z = 1$ is cancelled by a zero:原因是 $z = 1$ 的極點被零點抵消了:理由は、$z = 1$ の極が零点に打ち消されることにある。
This bears directly on the phase and group delay discussed in §10.3:這和 §10.3 討論的相位、群延遲直接相關:これは §10.3 で論じた位相と群遅延に直結する。
| Property特性特性 | FIR | IIR |
|---|---|---|
| Stability穩定性安定性 | always stable (no poles away from the origin)一定穩定(沒有原點以外的極點)つねに安定(原点以外に極がない) | the poles must lie inside the unit circle極點必須在單位圓內極が単位円の内側になければならない |
| Linear phase線性相位線形位相 | obtained simply by making the coefficients symmetric; the group delay is fixed at $(N-1)/2$係數對稱即可做到,群延遲固定為 $(N-1)/2$係数を対称にするだけで得られ、群遅延は $(N-1)/2$ に固定される | a causal system cannot achieve it exactly; the group delay varies with frequency因果系統無法做到精確線性相位,群延遲隨頻率變化因果システムでは厳密には達成できず、群遅延は周波数とともに変わる |
| Order needed for the same specification達成相同規格所需的階數同じ仕様に必要な次数 | high (tens to hundreds of taps may be needed)高(可能需要數十到數百個 taps)高い(数十から数百のタップが要ることもある) | low (poles produce sharp frequency selectivity)低(極點能產生尖銳的頻率選擇性)低い(極が鋭い周波数選択性を生む) |
| Computation and memory計算量、記憶體計算量と記憶量 | larger較大大きい | smaller較小小さい |
| Effect of finite precision有限精度的影響有限語長の影響 | insensitive; errors do not accumulate不敏感,誤差不會累積鈍感であり、誤差は蓄積しない | sensitive: coefficient quantization can displace the poles, even out of the unit circle, and rounding error circulates in the feedback, possibly producing a limit cycle敏感:係數量化可能讓極點移位甚至跑出單位圓;捨入誤差會在回授中循環,可能產生 limit cycle敏感である。係数の量子化は極を動かし、単位円の外へ出すことさえある。丸め誤差は帰還の中を回り、リミットサイクルを生むことがある。 |
The examples met earlier happen to stand on opposite sides:前面的例子剛好各代表一邊:これまでの例は、ちょうど両側に一つずつ立っている。
Filter gains span many orders of magnitude, so magnitude responses are usually plotted on a logarithmic decibel scale:濾波器的增益橫跨好幾個數量級,因此振幅響應通常畫在對數的分貝刻度上:フィルタの利得は何桁にもわたるため、振幅応答はふつう対数のデシベル尺度で描かれる。
| $|H|$ | $|H|^2$ (power)$|H|^2$(功率)$|H|^2$(電力) | gain in dB以 dB 表示的增益dB で表した利得 | read as讀作読み方 |
|---|---|---|---|
| $1$ | $1$ | $0$ dB$0$ 分貝$0$ デシベル | unity gain增益為 1利得 1 倍 |
| $1/\sqrt{2}\approx 0.707$ | $1/2$ | $-3$ dB$-3$ 分貝$-3$ デシベル | half-power point(半功率點)半功率點半電力点 |
| $1/2$ | $1/4$ | $-6$ dB$-6$ 分貝$-6$ デシベル | halving the amplitude振幅減半振幅が半分 |
| $0.1$ | $0.01$ | $-20$ dB$-20$ 分貝$-20$ デシベル | one decade down降低一個數量級1 桁下がる |
| $0.01$ | $10^{-4}$ | $-40$ dB$-40$ 分貝$-40$ デシベル | two decades down降低兩個數量級2 桁下がる |
The simplest lowpass filter(低通濾波器)averages the current and previous samples:最簡單的低通濾波器,就是把目前與前一個樣本取平均:最も単純な低域通過フィルタは、現在と一つ前の標本を平均するものである。
Its frequency response factors into a real amplitude and a linear phase:它的頻率響應可以分解成一個實數振幅乘上一個線性相位:その周波数応答は、実数の振幅と線形位相の積に分解できる。
These two slides use the simplest lowpass filter there is to revise every tool met so far — pole-zero, the linear phase of a symmetric FIR, the geometric reading of the magnitude — and end by introducing the definition of the cutoff frequency. Start by clearing the $z^{-1}$ out of $H_0(z)$:這兩張投影片用最簡單的低通濾波器,複習前面學過的所有工具:pole-zero、對稱 FIR 的線性相位、幾何詮釋,最後引入截止頻率的定義。先把 $H_0(z)$ 中的 $z^{-1}$ 清掉:この二枚のスライドは、ありうる最も単純な低域通過フィルタを使って、これまでの道具——極零配置、対称 FIR の線形位相、振幅の幾何学的な読み方——をすべて復習し、最後に遮断周波数の定義を導入する。まず $H_0(z)$ から $z^{-1}$ を払う。
Substitute $z = e^{j\omega}$ and pull out $-\omega/2$, the midpoint of the exponents $0$ and $-\omega$:代入 $z = e^{j\omega}$,把指數 $0$ 和 $-\omega$ 的中間值 $-\omega/2$ 提出來:$z = e^{j\omega}$ を代入し、指数 $0$ と $-\omega$ の中点である $-\omega/2$ をくくり出す。
The last step is Euler's formula, $e^{j\omega/2} + e^{-j\omega/2} = 2\cos(\omega/2)$, whose 2 cancels the $\tfrac12$ exactly. That is the step the green arrow on the slide points at. The result splits into two parts:最後一步用 Euler 公式:$e^{j\omega/2} + e^{-j\omega/2} = 2\cos(\omega/2)$,正好和前面的 $\tfrac12$ 約掉。投影片上的綠色箭頭指的就是這一步。結果拆成兩部分:最後の一歩はオイラーの公式 $e^{j\omega/2} + e^{-j\omega/2} = 2\cos(\omega/2)$ であり、その 2 が前の $\tfrac12$ とちょうど約分される。スライドの緑の矢印が指しているのがこの一歩である。結果は二つの部分に分かれる。
| Part部分部分 | What it is意義意味 |
|---|---|
| $\cos(\omega/2)$ | real, and it is the magnitude response. It stays $\ge 0$ throughout $[0,\pi]$, so there is no $\pi$ jump in the phase.實數,就是大小響應。在 $[0, \pi]$ 上恆 $\ge 0$,所以沒有 $\pi$ 的相位跳躍。実数であり、振幅応答そのものである。$[0,\pi]$ 上でつねに $\ge 0$ なので、位相に $\pi$ の跳びは生じない。 |
| $e^{-j\omega/2}$ | linear phase, $\theta(\omega) = -\omega/2$.線性相位,$\theta(\omega) = -\omega/2$。線形位相であり、$\theta(\omega) = -\omega/2$ である。 |
From the phase:由相位可得:位相から次が得られる。
The phase is a straight line through the origin, so the phase delay and the group delay are equal, both half a sample. That is what "½ sample delay" on the slide means. The reason is the same as for the 3-point filter of §10.2.5: $h[n]$ is symmetric about $n = \tfrac12$, the midpoint of its two coefficients.相位是一條通過原點的直線,所以相位延遲和群延遲相等,都是半個樣本。這就是投影片「½ sample delay」的意思。原因和 §10.2.5 的 3 點濾波器一樣:$h[n]$ 對稱於 $n = \tfrac12$(兩個係數的中間)。位相は原点を通る直線なので、位相遅延と群遅延は等しく、ともに半標本である。これがスライドの「½ sample delay」の意味である。理由は §10.2.5 の 3 点フィルタと同じで、$h[n]$ がその二つの係数の中点 $n = \tfrac12$ について対称だからである。
A discrete-time signal has values only at integer instants, so "a delay of 0.5 samples" sounds odd. What actually happens, for an input $\cos(\omega_0 n)$, is this:離散時間訊號只在整數時刻有值,「延遲 0.5 個樣本」聽起來很奇怪。實際上,輸入 $\cos(\omega_0 n)$ 時:離散時間信号は整数の時刻にしか値をもたないので、「0.5 標本の遅れ」は奇妙に聞こえる。入力 $\cos(\omega_0 n)$ に対して実際に起きているのは次のことである。
Averaging two adjacent samples amounts to taking the value of that sinusoid exactly halfway between them, times a shrinking factor. So every output sample lands where the input curve is, shifted right by half a step. The interactive figure below shows this directly.把兩個相鄰樣本平均,相當於取那條正弦曲線在兩個樣本正中間的值(再乘上一個縮小因子)。所以輸出的每個樣本,都落在輸入曲線往右平移半格的位置。下面的互動圖可以直接看到這點。隣り合う 2 標本を平均することは、その正弦曲線のちょうど真ん中の値を(縮小因子を掛けて)取ることにあたる。したがって出力の各標本は、入力曲線を右へ半目盛ずらした位置に落ちる。下のインタラクティブな図でそれが直に見える。
Put a zero at $z=-1$ and a lowpass filter is what comes out. This is the lesson "a zero produces a minimum of the magnitude" of §10.2.4 put to work.零點放在 $z = -1$,就得到一個低通濾波器。這正是 §10.2.4「零點造成大小的極小值」的應用。$z=-1$ に零点を置けば、出てくるのは低域通過フィルタである。これは §10.2.4 の「零点は振幅の極小を作る」をそのまま使ったものである。
Why a definition is needed. The magnitude response of this filter is a smoothly falling curve with no clear boundary between "passed" and "blocked". To describe the filter with a single number, a boundary has to be agreed upon, and that is the cutoff frequency $\omega_c$.為什麼需要定義。這個濾波器的大小響應是平滑下降的曲線,沒有明確的「通過」和「擋掉」的分界。為了用一個數字描述濾波器,需要約定一個分界點,這就是截止頻率 $\omega_c$。なぜ定義が要るのか。このフィルタの振幅応答はなめらかに下がる曲線であり、「通す」と「遮る」の明確な境目がない。フィルタを一つの数で表すには境目を取り決めねばならず、それが遮断周波数 $\omega_c$ である。
The half-power point. The commonest definition is the frequency at which the power has fallen to half its maximum:半功率點。最常用的定義是功率降到最大值一半的頻率:半電力点。最もよく使われる定義は、電力が最大値の半分まで落ちる周波数である。
Why power and not amplitude? The power of a signal is proportional to the square of its amplitude, so "half the power" is "the amplitude times $1/\sqrt2$". In decibels:為什麼用功率而不是振幅?訊號的功率和振幅的平方成正比,所以「功率減半」就是「振幅乘上 $1/\sqrt2$」。換成 dB:なぜ振幅ではなく電力なのか。信号の電力は振幅の二乗に比例するので、「電力が半分」は「振幅が $1/\sqrt2$ 倍」である。dB に直すと次のようになる。
So the half-power point is also commonly called the $-3$ dB point, as in §11.1.2. For the two-point average the maximum is at $\omega=0$ with $H_{\max}=1$, and solving $\cos(\omega_c/2) = 1/\sqrt2$ gives $\omega_c = \pi/2$, as in Worked Example 11-A above. Translated into a real frequency, $\omega=\pi$ corresponds to $f_s/2$ (the Nyquist frequency), so $\omega_c = \pi/2$ corresponds to $f_c = f_s/4$: at a sampling rate of 48 kHz, the cutoff is 12 kHz.所以半功率點也常叫做 $-3$ dB 點,如 §11.1.2 所述。兩點平均的最大值在 $\omega = 0$,$H_{\max} = 1$;令 $\cos(\omega_c/2) = 1/\sqrt2$ 解得 $\omega_c = \pi/2$,就是上面範例 11-A 的結果。換成實際頻率,$\omega = \pi$ 對應 $f_s/2$(Nyquist 頻率),所以 $\omega_c = \pi/2$ 對應 $f_c = f_s/4$。例如取樣率 48 kHz,截止頻率就是 12 kHz。そのため半電力点は §11.1.2 にあるとおり $-3$ dB 点とも呼ばれる。2 点平均では最大値は $\omega=0$ にあり $H_{\max}=1$ である。$\cos(\omega_c/2) = 1/\sqrt2$ を解けば $\omega_c = \pi/2$ となり、上の例題 11-A の結果と一致する。実際の周波数に直すと、$\omega=\pi$ が $f_s/2$(ナイキスト周波数)に対応するので、$\omega_c = \pi/2$ は $f_c = f_s/4$ にあたる。標本化周波数 48 kHz なら遮断周波数は 12 kHz である。
This is a very "gentle" lowpass: it does not reach $-3$ dB until $\pi/2$ and does not reach zero until $\pi$, so the transition band takes up half the whole band. One simple way to steepen it is to cascade $K$ identical two-point averages:這是很「緩」的低通濾波器:在 $\pi/2$ 才降到 $-3$ dB,到 $\pi$ 才完全歸零,過渡帶佔了整個頻帶的一半。要讓它更陡,一種簡單的方法是串接 $K$ 個相同的 2 點平均:これはきわめて「ゆるい」低域通過である。$-3$ dB に達するのが $\pi/2$、零になるのが $\pi$ であり、遷移帯が帯域全体の半分を占めてしまう。急峻にする簡単な方法の一つは、同じ 2 点平均を $K$ 個縦続接続することである。
This amounts to stacking $K$ zeros at $z=-1$, and the coefficients become the binomial coefficients — $\{\tfrac14,\ \tfrac12,\ \tfrac14\}$ for $K=2$, for instance. The larger $K$ is, the lower the cutoff frequency and the faster the decay at high frequencies, while the group delay rises to $K/2$. The cascade is taken up properly in §11.4; the interactive figure below lets $K$ be adjusted here.這相當於把 $K$ 個零點都疊在 $z = -1$,係數是二項式係數,例如 $K = 2$ 時是 $\{\tfrac14,\ \tfrac12,\ \tfrac14\}$。$K$ 越大,截止頻率越低,曲線在高頻衰減越快,群延遲則增加為 $K/2$。串接本身留到 §11.4 正式討論;下面的互動圖可以在這裡先調整 $K$。これは $z=-1$ に零点を $K$ 個重ねることにあたり、係数は二項係数になる。たとえば $K=2$ なら $\{\tfrac14,\ \tfrac12,\ \tfrac14\}$ である。$K$ が大きいほど遮断周波数は低くなり、高域での減衰は速くなる。一方で群遅延は $K/2$ へと増える。縦続接続そのものは §11.4 で本格的に扱う。下のインタラクティブな図では、ここで $K$ を動かせる。
$K=1$: drag $\omega_0$ (or drag the green point round the pole-zero plot). The blue zero vector runs from $z=-1$ to the green point, and its length divided by 2 is $|H|$:$K = 1$,拖動 $\omega_0$(或在 pole-zero 圖上拖動綠點)。藍色零點向量從 $z = -1$ 連到綠點。它的長度除以 2,就是 $|H|$:$K=1$ で $\omega_0$ をドラッグする(または極零配置の緑の点を動かす)。青い零点ベクトルは $z=-1$ から緑の点へ伸び、その長さを 2 で割ったものが $|H|$ である。
Look for the half-sample delay in the time-domain panel. Every blue output dot lands on the blue dashed line, and that line is nothing but the grey input curve shifted right by 0.5 and shrunk by $|H|$. Each output sample is exactly the value of the input curve halfway between two samples. Pull $\omega_0$ up close to $\pi$ and the input is nearly alternating $(+1, -1, +1, \ldots)$, so the average of two neighbours is nearly 0. That is what a zero at $z=-1$ means in the time domain.看時域圖的半樣本延遲。藍色輸出點都落在藍色虛線上,而這條虛線就是灰色輸入曲線往右平移 0.5 格、再縮小 $|H|$ 倍。每個輸出點,正好是輸入曲線在兩個樣本中間的值。把 $\omega_0$ 拉到接近 $\pi$,輸入幾乎是正負交錯($+1, -1, +1, \ldots$),相鄰兩點平均後幾乎是 0。這就是零點在 $z = -1$ 的時域意義。時間領域のパネルで半標本の遅れを見る。青い出力点はすべて青い破線の上に落ち、その線は灰色の入力曲線を右へ 0.5 ずらして $|H|$ 倍しただけのものである。各出力標本は、入力曲線の 2 標本のちょうど中間の値にあたる。$\omega_0$ を $\pi$ の近くまで上げると入力はほぼ交互($+1, -1, +1, \ldots$)になり、隣接 2 点の平均はほぼ 0 になる。これが $z=-1$ の零点の時間領域での意味である。
Pull $K$ from 1 up to 6.把 $K$ 從 1 拉到 6。$K$ を 1 から 6 まで上げる。
Generalizing to an average of $M$ samples gives the moving-average filter(移動平均濾波器), the workhorse of noise smoothing:推廣成 $M$ 個樣本的平均,就得到移動平均濾波器,它是雜訊平滑的主力:$M$ 標本の平均に一般化すると移動平均フィルタが得られる。雑音平滑化の主力である。
The magnitude is a periodic-sinc (Dirichlet) shape with nulls at $\omega = 2\pi k/M$, $k=1,\dots,M-1$: any sinusoid completing a whole number of cycles inside the averaging window averages to zero. Increasing $M$ narrows the passband and increases the smoothing, at the cost of a longer delay $(M-1)/2$ samples.振幅是週期 sinc(Dirichlet)的形狀,並在$\omega = 2\pi k/M$ 處出現零點,$k=1,\dots,M-1$:任何在平均視窗內剛好走完整數個週期的弦波,平均之後都是零。把 $M$ 加大會讓通帶變窄、平滑更強,代價是延遲變長為 $(M-1)/2$ 個樣本。振幅は周期 sinc(Dirichlet)の形をしており、$\omega = 2\pi k/M$ に零点をもつ($k=1,\dots,M-1$)。平均化窓の中でちょうど整数回の周期を終える正弦波は、平均すると零になるからである。$M$ を大きくすると通過帯域は狭くなり平滑化は強まるが、その代わり遅延が $(M-1)/2$ 標本と長くなる。
b = ones(1,M)/M; y = filter(b,1,x); implements the causal moving average. Use freqz(b,1) to inspect its magnitude/phase. It is a fine smoother but a poor lowpass filter: its first sidelobe is only about 13 dB down, so stopband rejection is weak.b = ones(1,M)/M; y = filter(b,1,x); 就實作出因果的移動平均。用 freqz(b,1) 可以檢視它的振幅與相位。它是不錯的平滑器,卻是很差的低通濾波器:第一個旁瓣只低了大約 13 dB,阻帶抑制很弱。b = ones(1,M)/M; y = filter(b,1,x); で因果的な移動平均が実装できる。振幅と位相は freqz(b,1) で確認するとよい。平滑化器としては優秀だが、低域通過フィルタとしては出来が悪い。第一サイドローブが約 13 dB しか下がらないため、阻止帯域の抑圧が弱いのである。
Flipping the sign of the second tap turns the averager into a differencer — the simplest highpass filter(高通濾波器):把第二個抽頭的符號翻過來,平均器就變成差分器——這是最簡單的高通濾波器:2 番目のタップの符号を反転させると、平均器は差分器に変わる——これが最も単純な高域通過フィルタである。
Now the zero sits at $z=+1$ ($\omega=0$): DC is annihilated, while the fastest alternation $(-1)^n$ passes with gain 1. Its 3-dB cutoff is again $\omega_c = \pi/2$. In fact $h_1[n]=(-1)^n h_0[n]$ — replacing $z$ by $-z$ shifts a frequency response by $\pi$, converting lowpass to highpass(把 $z\to-z$,頻率響應平移 π,低通變高通).現在零點落在 $z=+1$($\omega=0$):直流被消滅,而振盪最快的 $(-1)^n$ 以增益 1 通過。它的 3-dB 截止頻率同樣是 $\omega_c = \pi/2$。事實上 $h_1[n]=(-1)^n h_0[n]$ ——把 $z$ 換成 $-z$ 會讓頻率響應平移 $\pi$,於是 $z\to-z$ 就把低通變成了高通。今度は零点が $z=+1$($\omega=0$)にあり、直流が消される一方、最も速く振動する $(-1)^n$ は利得 1 で通過する。3-dB 遮断周波数はやはり $\omega_c = \pi/2$ である。実際 $h_1[n]=(-1)^n h_0[n]$ であって、$z$ を $-z$ に置き換えると周波数応答は $\pi$ だけ平行移動する。つまり $z\to-z$ が低域通過を高域通過に変えるのである。
These two slides introduce the highpass that corresponds to the two-point lowpass, and end with a very practical trick: multiply $h[n]$ by $(-1)^n$ and a lowpass becomes a highpass. Where the lowpass takes the average of two neighbouring samples, the highpass takes their difference:這兩張投影片介紹與低通相對應的高通濾波器,並說明一個很實用的技巧:把 $h[n]$ 乘上 $(-1)^n$,低通就變成高通。低通是相鄰樣本取平均,高通則是取差:この二枚のスライドは、2 点低域通過に対応する高域通過フィルタを導入し、最後にとても実用的な手口を示す。$h[n]$ に $(-1)^n$ を掛ければ、低域通過は高域通過になる。低域通過が隣り合う標本の平均をとるのに対し、高域通過はその差をとる。
This is nothing but the discrete-time derivative (the first difference), and it is used to detect change. Clearing the $z^{-1}$ out of $H_H(z)$ as before:這其實就是離散時間的微分(一階差分),用來偵測變化。和前面一樣,先把 $H_H(z)$ 中的 $z^{-1}$ 清掉:これはまさに離散時間の微分(一次差分)であり、変化を検出するのに使われる。前と同じく、まず $H_H(z)$ から $z^{-1}$ を払う。
Compared with the lowpass, the zero has moved from $z=-1$ to $z=1$.和低通相比,零點從 $z = -1$ 移到了 $z = 1$。低域通過と比べると、零点が $z=-1$ から $z=1$ へ移っている。
Pull out $e^{-j\omega/2}$ with the same trick as for the lowpass:用同樣的技巧,提出 $e^{-j\omega/2}$:低域通過と同じ手口で $e^{-j\omega/2}$ をくくり出す。
This time the bracket is a difference, and by Euler's formula $e^{j\omega/2} - e^{-j\omega/2} = 2j\sin(\omega/2)$. Set against the lowpass $e^{-j\omega/2}\cos(\omega/2)$ there are two differences: cos has become sin, and there is an extra factor of $j$.這次括號裡是相減,由 Euler 公式 $e^{j\omega/2} - e^{-j\omega/2} = 2j\sin(\omega/2)$。和低通 $e^{-j\omega/2}\cos(\omega/2)$ 比較,有兩個差別:cos 變成 sin,以及多了一個 $j$。今度は括弧の中が差であり、Euler の公式から $e^{j\omega/2} - e^{-j\omega/2} = 2j\sin(\omega/2)$ となる。低域通過の $e^{-j\omega/2}\cos(\omega/2)$ と比べると違いは二つある。cos が sin になったことと、$j$ が一つ余分に付いたことである。
Geometrically this is the length of the zero vector — from $z=1$ to $e^{j\omega}$ — divided by 2:從幾何上看,就是零點向量(從 $z = 1$ 指向 $e^{j\omega}$)的長度除以 2:幾何学的には、零点ベクトル($z=1$ から $e^{j\omega}$ へ)の長さを 2 で割ったものである。
The cutoff is exactly the same as the lowpass's — again. That is no coincidence; the reason comes with the second slide below.截止頻率和低通完全相同(again)。這不是巧合,原因在第二張投影片。遮断周波数は低域通過とまったく同じである——またしても。これは偶然ではなく、理由は下の二枚目のスライドで明らかになる。
Since $j = e^{j\pi/2}$, for $0 < \omega < \pi$:$j = e^{j\pi/2}$,所以在 $0 < \omega < \pi$ 時:$j = e^{j\pi/2}$ であるから、$0 < \omega < \pi$ では次のようになる。
This is a straight line of slope $-\tfrac12$ that does not pass through the origin — the second kind of linear phase, generalized linear phase, which §11.6.2 treats in full:這是一條斜率 $-\tfrac12$、但不通過原點的直線,對應第二種線性相位——廣義線性相位,§11.6.2 會完整討論:これは傾き $-\tfrac12$ の直線だが、原点を通らない。線形位相の第二の種類、一般化線形位相であり、§11.6.2 で本格的に扱う。
| Lowpass $h_L$低通 $h_L$低域通過 $h_L$ | Highpass $h_H$高通 $h_H$高域通過 $h_H$ | |
|---|---|---|
| Coefficients係數係数 | symmetric $\{\tfrac12, \tfrac12\}$對稱 $\{\tfrac12, \tfrac12\}$対称 $\{\tfrac12, \tfrac12\}$ | antisymmetric $\{\tfrac12, -\tfrac12\}$反對稱 $\{\tfrac12, -\tfrac12\}$反対称 $\{\tfrac12, -\tfrac12\}$ |
| Phase相位位相 | $-\omega/2$ | $\pi/2 - \omega/2$ |
| Group delay $\tau_g$群延遲 $\tau_g$群遅延 $\tau_g$ | $\tfrac12$ | $\tfrac12$ |
| Phase delay $\tau_p$相位延遲 $\tau_p$位相遅延 $\tau_p$ | $\tfrac12$ | $\tfrac12 - \dfrac{\pi}{2\omega}$ (varies with frequency)$\tfrac12 - \dfrac{\pi}{2\omega}$(隨頻率變化)$\tfrac12 - \dfrac{\pi}{2\omega}$(周波数とともに変わる) |
The group delay is still $\tfrac12$, so the envelope is not distorted; but the carrier picks up a fixed $90^\circ$ lead. That matches the "derivative" reading exactly: the derivative of cos is $-\sin$, a phase difference of $90^\circ$. At low frequency $H_H \approx j\omega/2$, which is the ideal differentiator $j\omega$ times $\tfrac12$.群延遲仍然是 $\tfrac12$,所以包絡不失真;但載波多了固定的 $90^\circ$ 超前。這正好呼應「微分」的解讀:cos 的微分是 $-\sin$,相位剛好差 $90^\circ$。在低頻時,$H_H \approx j\omega/2$,就是理想微分器 $j\omega$ 乘上 $\tfrac12$。群遅延は相変わらず $\tfrac12$ なので包絡は歪まない。だが搬送波には一定の $90^\circ$ の進みが付く。これは「微分」という読み方とぴったり合う。cos の微分は $-\sin$ であり、位相はちょうど $90^\circ$ ずれる。低い周波数では $H_H \approx j\omega/2$ で、理想微分器 $j\omega$ の $\tfrac12$ 倍である。
On either side of $\omega=0$, $\sin(\omega/2)$ changes sign, so the phase jumps from $-\pi/2$ to $+\pi/2$ — a jump of $\pi$. As before, this happens at a zero, where $|H|=0$.在 $\omega = 0$ 兩側,$\sin(\omega/2)$ 變號,相位從 $-\pi/2$ 跳到 $+\pi/2$,跳了 $\pi$。這和前面的情況一樣,發生在 $|H| = 0$ 的零點上。$\omega=0$ の両側で $\sin(\omega/2)$ の符号が変わるので、位相は $-\pi/2$ から $+\pi/2$ へ、つまり $\pi$ だけ跳ぶ。前と同じく、これは $|H|=0$ となる零点で起こる。
Time domain: multiply by $(-1)^n$. Check it: $h_L[0] = \tfrac12$ times $(-1)^0 = 1$ is still $\tfrac12$; $h_L[1] = \tfrac12$ times $(-1)^1 = -1$ becomes $-\tfrac12$.時域:乘上 $(-1)^n$。驗證:$h_L[0] = \tfrac12$ 乘上 $(-1)^0 = 1$,仍是 $\tfrac12$;$h_L[1] = \tfrac12$ 乘上 $(-1)^1 = -1$,變成 $-\tfrac12$。時間領域:$(-1)^n$ を掛ける。確かめると、$h_L[0] = \tfrac12$ に $(-1)^0 = 1$ を掛けても $\tfrac12$ のまま、$h_L[1] = \tfrac12$ に $(-1)^1 = -1$ を掛けると $-\tfrac12$ になる。
z-domain: replace $z$ by $-z$, which rotates the whole z-plane by $180^\circ$. Every zero and pole moves to the opposite side: the lowpass zero at $z=-1$ lands on $z=1$, and the pole at the origin stays at the origin under the rotation. The coloured discs on the slide are domain colouring — the colour of each point encodes the angle of $z$. The left disc is $z$ and the right disc is $-z$; the colours have turned half a revolution, showing that the same value now appears at the opposite position.z 域:把 $z$ 換成 $-z$,等於把整個 z 平面旋轉 $180^\circ$。所有零點和極點都移到對面:低通在 $z = -1$ 的零點,移到 $z = 1$;原點的極點旋轉後仍在原點。投影片中的彩色圓盤是 domain coloring:每個點的顏色代表 $z$ 的角度。左邊是 $z$,右邊是 $-z$,顏色整體轉了半圈,表示同一個值出現在對面的位置。z 領域:$z$ を $-z$ に置き換える。これはz 平面全体を $180^\circ$ 回すことにあたる。零点も極もすべて反対側へ移る。低域通過の $z=-1$ の零点は $z=1$ へ移り、原点の極は回しても原点のままである。スライドの色付きの円盤は domain coloring で、各点の色が $z$ の偏角を表す。左が $z$、右が $-z$ であり、色が全体として半回転している。同じ値が反対の位置に現れるということである。
Frequency domain: the whole response shifts by $\pi$. On the unit circle $-e^{j\omega} = e^{j(\omega+\pi)}$. The lowpass was largest at $\omega=0$ and zero at $\pi$; after the shift it is largest at $\pi$ and zero at 0 — a highpass. The two plots at the bottom of the slide are exactly this shift, and the identity on the right checks it directly. The cutoff $\pi/2$, shifted by $\pi$, corresponds to $-\pi/2$, whose absolute value is still $\pi/2$ — which is why the two cutoffs agree.頻域:整個頻率響應平移 $\pi$。在單位圓上 $-e^{j\omega} = e^{j(\omega + \pi)}$。低通原本在 $\omega = 0$ 最大、在 $\pi$ 為 0;平移後變成在 $\pi$ 最大、在 0 為 0,也就是高通。投影片下方的兩張圖就是這個平移,右邊的恆等式可以直接驗證。截止頻率 $\pi/2$ 平移 $\pi$ 之後,對應的是 $-\pi/2$,取絕對值仍是 $\pi/2$,所以兩者的截止頻率相同。周波数領域:周波数応答全体が $\pi$ だけずれる。単位円の上では $-e^{j\omega} = e^{j(\omega+\pi)}$ である。低域通過はもともと $\omega=0$ で最大、$\pi$ で 0 だった。ずらした後は $\pi$ で最大、0 で 0 になる。これが高域通過である。スライド下段の二つの図はまさにこのずれであり、右の恒等式で直接確かめられる。遮断周波数 $\pi/2$ を $\pi$ ずらすと $-\pi/2$ に対応し、絶対値はやはり $\pi/2$ である。二つの遮断周波数が一致するのはそのためである。
Multiplying by a complex exponential in the time domain shifts the frequency response by $\omega_0$. The case $\omega_0=\pi$ is special because $e^{j\pi n}$ happens to be the real number $\pm1$, so the coefficients stay real. The trick works for any lowpass: the 3-point binomial lowpass $\{\tfrac14, \tfrac12, \tfrac14\}$, multiplied by $(-1)^n$, gives the highpass $\{\tfrac14, -\tfrac12, \tfrac14\}$. The interactive figure below performs the rotation continuously: the slider sets the rotation angle $\omega_0$, with 0 the lowpass and $\pi$ the highpass, and any angle in between a filter with complex coefficients.時域乘上一個複指數,頻域就平移 $\omega_0$。$\omega_0 = \pi$ 是特例,因為 $e^{j\pi n}$ 剛好是實數 $\pm1$,係數維持實數。這個技巧適用於任何低通濾波器。例如 3 點二項式低通 $\{\tfrac14, \tfrac12, \tfrac14\}$,乘上 $(-1)^n$ 就得到高通 $\{\tfrac14, -\tfrac12, \tfrac14\}$。下面的互動圖把這個旋轉連續地做出來:滑桿控制旋轉角度 $\omega_0$,0 是低通,$\pi$ 是高通,中間的角度則是複數係數的濾波器。時間領域で複素指数を掛けると、周波数領域では $\omega_0$ だけずれる。$\omega_0=\pi$ が特別なのは、$e^{j\pi n}$ がたまたま実数 $\pm1$ であり、係数が実数のままだからである。この手口はどんな低域通過フィルタにも使える。たとえば 3 点の二項低域通過 $\{\tfrac14, \tfrac12, \tfrac14\}$ に $(-1)^n$ を掛ければ、高域通過 $\{\tfrac14, -\tfrac12, \tfrac14\}$ が得られる。下のインタラクティブな図は、この回転を連続的に行う。スライダが回転角 $\omega_0$ を決め、0 が低域通過、$\pi$ が高域通過、その間の角度は複素係数のフィルタになる。
Pull the rotation slowly from "lowpass" to "highpass". In the pole-zero plot the zero travels along the unit circle from $z=-1$ to $z=1$; the grey dashed arc is the path it has covered. At the same time the blue magnitude curve slides to the right relative to the grey lowpass curve, by exactly $\omega_0$ (the green arrow).從「低通」慢慢拉到「高通」。在 pole-zero 圖中,零點沿著單位圓,從 $z = -1$ 轉到 $z = 1$,灰色虛線弧就是它走過的路徑。同時,大小響應的藍色曲線相對於灰色低通曲線整體往右平移,平移量正好是 $\omega_0$(綠色箭頭)。回転を「低域通過」から「高域通過」へゆっくり動かす。極零配置では零点が単位円に沿って $z=-1$ から $z=1$ へ回り、灰色の破線の弧がその通った道である。同時に振幅応答の青い曲線が灰色の低域通過の曲線に対して右へ、ちょうど $\omega_0$(緑の矢印)だけずれる。
Note that the horizontal axis runs from $-\pi$ to $\pi$, so at a shift of $\pi$ the lowpass peak at 0 moves to $\pm\pi$ and the edge "folds back" onto the other side. That is because the frequency response is periodic in $2\pi$.注意圖的橫軸畫的是 $-\pi$ 到 $\pi$,所以平移 $\pi$ 時,低通在 0 的峰值移到 $\pm\pi$,邊緣被「折回」另一側。這是頻率響應以 $2\pi$ 為週期造成的。横軸は $-\pi$ から $\pi$ までなので、$\pi$ ずらすと低域通過の 0 にあった山は $\pm\pi$ へ移り、端が反対側へ「折り返される」ことに注意する。周波数応答が $2\pi$ 周期であるためである。
Press "halfway ($\omega_0 = \pi/2$)". The coefficients become complex (blue real part, orange imaginary part) and the magnitude response is no longer symmetric: it is largest at $+\pi/2$ and zero at $-\pi/2$. A filter with real coefficients always has a symmetric magnitude response, so the rotated coefficients are real only for $\omega_0 = 0$ or $\pi$. That is why lowpass-to-highpass uses exactly $(-1)^n$.按「中間($\omega_0 = \pi/2$)」。係數變成複數(藍色是實部,橘色是虛部),大小響應不再左右對稱:在 $+\pi/2$ 最大,在 $-\pi/2$ 為 0。實數係數的濾波器,大小響應一定左右對稱,所以只有 $\omega_0 = 0$ 或 $\pi$ 時,旋轉後的係數才會是實數。這就是為什麼低通變高通剛好用 $(-1)^n$。「中間($\omega_0 = \pi/2$)」を押す。係数は複素数になり(青が実部、橙が虚部)、振幅応答は左右対称でなくなる。$+\pi/2$ で最大、$-\pi/2$ で 0 である。実係数のフィルタの振幅応答は必ず左右対称なので、回した係数が実数になるのは $\omega_0 = 0$ か $\pi$ のときだけである。低域通過から高域通過への変換にちょうど $(-1)^n$ を使うのはそのためである。
In highpass mode, drag the observation frequency.在高通模式下,拖動觀察頻率。高域通過のまま、観察する周波数をドラッグする。
Set $K$ to 2, then switch between lowpass and highpass. The lowpass is the binomial $\{\tfrac14, \tfrac12, \tfrac14\}$ and the highpass becomes $\{\tfrac14, -\tfrac12, \tfrac14\}$ — exactly the coefficients times $(-1)^n$. The double zero travels from $-1$ to $1$ as one, and the two cutoffs remain mirror images about $\pi/2$.把 $K$ 調到 2,再切換低通和高通。低通是二項式 $\{\tfrac14, \tfrac12, \tfrac14\}$,高通變成 $\{\tfrac14, -\tfrac12, \tfrac14\}$,正好是係數乘上 $(-1)^n$。二重零點一起從 $-1$ 轉到 $1$,兩者的截止頻率依然以 $\pi/2$ 為中心對稱。$K$ を 2 にして、低域通過と高域通過を切り替える。低域通過は二項係数 $\{\tfrac14, \tfrac12, \tfrac14\}$、高域通過は $\{\tfrac14, -\tfrac12, \tfrac14\}$ になり、まさに係数に $(-1)^n$ を掛けたものである。二重零点はそろって $-1$ から $1$ へ回り、二つの遮断周波数は相変わらず $\pi/2$ を中心に対称である。
| Viewpoint觀點見方 | Lowpass → highpass低通 → 高通低域通過 → 高域通過 |
|---|---|
| Time domain時域時間領域 | multiply the coefficients by $(-1)^n$係數乘上 $(-1)^n$係数に $(-1)^n$ を掛ける |
| z-domainz 域z 領域 | $z \to -z$; zeros and poles rotate by $180^\circ$$z \to -z$,零點和極點旋轉 $180^\circ$$z \to -z$。零点と極が $180^\circ$ 回る |
| Frequency domain頻域周波数領域 | the frequency response shifts by $\pi$頻率響應平移 $\pi$周波数応答が $\pi$ だけずれる |
| Property behind it背後的性質背後にある性質 | the modulation property of the DTFT, $(-1)^n = e^{j\pi n}$DTFT 的調變性質,$(-1)^n = e^{j\pi n}$DTFT の変調性質、$(-1)^n = e^{j\pi n}$ |
Adding one feedback coefficient buys far more selectivity per multiply. All four classical responses — LP, HP, BP, BS — have standard first/second-order IIR prototypes, parameterized so that the gain is exactly 1 at the center of the passband and exactly 0 at the center of the stopband.只要加上一個回授係數,每一次乘法買到的選擇性就大幅提高。四種經典響應——LP、HP、BP、BS——都有標準的一階或二階 IIR 原型,而且參數化的方式讓通帶中心的增益恰好是 1、阻帶中心的增益恰好是 0。帰還係数を一つ加えるだけで、乗算一回あたりの選択度は格段に高くなる。古典的な四つの応答——LP・HP・BP・BS——にはいずれも標準的な 1 次/2 次の IIR プロトタイプがあり、通過帯域の中心で利得がちょうど 1、阻止帯域の中心でちょうど 0 になるように母数が選ばれている。
The zero at $z=-1$ forces $H_{LP}(e^{j\pi})=0$; the normalizing constant forces $H_{LP}(e^{j0})=1$. The pole at $z=\alpha$ (real, $0<\alpha<1$ in practice) boosts low frequencies — the closer $\alpha$ is to 1, the narrower the passband. The 3-dB cutoff is controlled directly by $\alpha$; the design equation is derived below.$z=-1$ 的零點迫使 $H_{LP}(e^{j\pi})=0$;歸一化常數則迫使 $H_{LP}(e^{j0})=1$。位於 $z=\alpha$ 的極點(實數,實務上 $0<\alpha<1$)會抬高低頻——$\alpha$ 越接近 1,通帶就越窄。3-dB 截止頻率直接由 $\alpha$ 控制,設計公式在下面推導。$z=-1$ の零点が $H_{LP}(e^{j\pi})=0$ を強制し、正規化定数が $H_{LP}(e^{j0})=1$ を強制する。$z=\alpha$ にある極(実数で、実用上は $0<\alpha<1$)が低域を持ち上げる。$\alpha$ が 1 に近いほど通過帯域は狭くなる。3-dB 遮断周波数は $\alpha$ が直接決める。設計式は以下で導く。
| Part部分部分 | Origin來源由来 | Role作用役割 |
|---|---|---|
| numerator $1+z^{-1}$分子 $1+z^{-1}$分子 $1+z^{-1}$ | the two-point average of §11.2.1就是 §11.2.1 的兩點平均§11.2.1 の 2 点平均そのもの | zero at $z=-1$: $\omega=\pi$ is nulled exactly零點在 $z=-1$,讓 $\omega=\pi$ 完全歸零$z=-1$ の零点で $\omega=\pi$ を完全に零にする |
| denominator $1-\alpha z^{-1}$分母 $1-\alpha z^{-1}$分母 $1-\alpha z^{-1}$ | the new feedback path新加入的回授新たに加えた帰還 | pole at $z=\alpha$ on the real axis極點在 $z=\alpha$(實軸上)実軸上の $z=\alpha$ に極 |
| $K$ | gain constant增益常數利得定数 | makes the DC gain exactly 1讓 DC 增益為 1直流利得をちょうど 1 にする |
The filter shows the four hallmarks of an IIR: feedback, both zeros and poles, conditional stability, and an $h[n]$ that is of little direct use. Writing $H_{LP}(z)=K\,\dfrac{1+z^{-1}}{1-\alpha z^{-1}}$ and cross-multiplying gives the difference equation這個濾波器具備 IIR 的四個特徵:回授、同時有零點和極點、條件式穩定、以及$h[n]$ 比較沒用。把 $H_{LP}(z)=K\,\dfrac{1+z^{-1}}{1-\alpha z^{-1}}$ 交叉相乘,得到差分方程式このフィルタは IIR の四つの特徴を備えている。帰還、零点と極の両方、条件付き安定、そして$h[n]$ があまり役に立たないことである。$H_{LP}(z)=K\,\dfrac{1+z^{-1}}{1-\alpha z^{-1}}$ をたすき掛けすると差分方程式が得られる。
Evaluate at DC, $z=1$:在 DC($z=1$)代入:直流 $z=1$ を代入する。
$$H_{LP}(1)=K\,\frac{1+1}{1-\alpha}=\frac{2K}{1-\alpha}=1\quad\Longrightarrow\quad K=\frac{1-\alpha}{2}$$Geometrically, at $z=1$ the zero vector (from $-1$ to $1$) has length 2 and the pole vector has length $1-\alpha$. The closer the pole is to 1, the smaller the denominator and the larger the raw DC gain, so $K$ must shrink to compensate.從幾何上看:在 $z=1$,零點向量長度是 2(從 $-1$ 到 $1$),極點向量長度是 $1-\alpha$。極點越靠近 1,分母越小,DC 增益越大,所以 $K$ 必須跟著縮小來補償。幾何的には、$z=1$ で零点ベクトル($-1$ から $1$)の長さは 2、極ベクトルの長さは $1-\alpha$ である。極が 1 に近いほど分母は小さく直流利得は大きくなるので、$K$ を小さくして補償しなければならない。
An FIR filter is always stable; an IIR filter is stable only if its poles lie inside the unit circle, here $|\alpha|<1$. The impulse response contains $\alpha^n$, which does not decay when $|\alpha|\ge1$:FIR 一定穩定,IIR 則必須滿足條件:極點在單位圓內,也就是 $|\alpha|<1$。脈衝響應中含有 $\alpha^n$ 這一項,$|\alpha|\ge1$ 時不會衰減:FIR は常に安定だが、IIR は極が単位円の内側にあるとき、ここでは $|\alpha|<1$ のときにだけ安定である。インパルス応答には $\alpha^n$ が含まれ、$|\alpha|\ge1$ では減衰しない。
$$h[n]=K\bigl(\alpha^n u[n]+\alpha^{n-1}u[n-1]\bigr)$$For an FIR filter $h[n]$ is the coefficient list used in the implementation. For an IIR filter it is infinitely long, so nobody implements it from $h[n]$; the implementation uses $\alpha$ and $K$ in the difference equation. IIR design and analysis therefore live in the z-domain and frequency domain, and $h[n]$ is used only to look at transient behaviour.FIR 的 $h[n]$ 就是係數本身,直接拿來實作。IIR 的 $h[n]$ 是無限長的,我們不會用這串數字來實作(無法存無限個係數),而是用差分方程中的 $\alpha$ 和 $K$。所以 IIR 的設計和分析主要在 z 域和頻域進行,$h[n]$ 只用來觀察暫態特性。FIR では $h[n]$ がそのまま実装に使う係数列である。IIR では $h[n]$ が無限に長いので、これから実装することはなく、差分方程式の $\alpha$ と $K$ を使う。したがって IIR の設計と解析は主に z 領域と周波数領域で行い、$h[n]$ は過渡特性を見るためにしか使わない。
Goal: given the desired $\omega_c$, find $\alpha$.目標:給定想要的 $\omega_c$,求出 $\alpha$。目標:望みの $\omega_c$ から $\alpha$ を求める。
Taking the "−" sign gives the design equation: specify the cutoff and read off the feedback coefficient directly.取「−」號就得到設計公式(design equation):指定截止頻率,直接得到回授係數。「−」の符号を取ると設計式が得られる。遮断周波数を指定すれば帰還係数がそのまま決まる。
| $\omega_c$ | $\alpha$ | Meaning意義意味 |
|---|---|---|
| $\pi/2$ | $0$ | pole at the origin: the filter collapses to the two-point average, whose cutoff is indeed $\pi/2$極點在原點,退化成 2 點移動平均,截止頻率確實是 $\pi/2$極が原点にあり 2 点平均に退化する。その遮断周波数は確かに $\pi/2$ である |
| $<\pi/2$ | $0<\alpha<1$ | pole on the positive real axis: passband narrower than the FIR version極點在正實軸,通帶比 FIR 版本窄極は正の実軸上にあり、通過帯域は FIR 版より狭い |
| $>\pi/2$ | $-1<\alpha<0$ | pole on the negative real axis: passband wider than the FIR version極點在負實軸,通帶比 FIR 版本寬極は負の実軸上にあり、通過帯域は FIR 版より広い |
| $\to0$ | $\to1$ | pole approaches $z=1$: a very narrow lowpass極點逼近 $z=1$,非常窄的低通極が $z=1$ に迫り、非常に狭い低域通過になる |
The two-point FIR has only one fixed cutoff, $\pi/2$. Adding one pole lets the cutoff be placed anywhere, at the cost of a single extra multiply. That is the efficiency advantage of IIR. The interactive figure below takes $\omega_c$ directly and shows the $\alpha$ the design equation returns together with the resulting responses.一個 FIR 只能有一個固定的截止頻率 $\pi/2$,加上一個極點後,就能把截止頻率設定在任何位置,而且只多了一次乘法。這就是 IIR 的效率優勢。下面的互動圖可以直接指定 $\omega_c$,觀察設計公式算出的 $\alpha$ 與各種響應。2 点 FIR の遮断周波数は $\pi/2$ に固定されている。極を一つ加えるだけで遮断周波数をどこにでも置け、増えるのは乗算一回だけである。これが IIR の効率面での利点である。下のインタラクティブな図では $\omega_c$ を直接指定し、設計式が返す $\alpha$ と各応答を観察できる。
Press "$\omega_c = 0.5\pi$ (FIR)". $\alpha=0$, the pole sits at the origin, the blue curve lies exactly on the grey FIR dashed curve, and the impulse response has only two samples. The two-point average is a special case of this IIR.按「$\omega_c = 0.5\pi$(FIR)」。$\alpha=0$,極點落在原點,藍色曲線和灰色 FIR 虛線完全重合,脈衝響應只剩 2 個樣本。這驗證了 2 點移動平均是這個 IIR 的特例。「$\omega_c = 0.5\pi$ (FIR)」を押す。$\alpha=0$ で極は原点にあり、青い曲線は灰色の FIR 破線と完全に重なり、インパルス応答は 2 標本だけになる。2 点平均はこの IIR の特別な場合である。
Drag the specified $\omega_c$ and watch the design equation.拖動「指定 $\omega_c$」,觀察設計公式。指定する $\omega_c$ をドラッグし、設計式を観察する。
Press "$\omega_c = 0.05\pi$".按「$\omega_c = 0.05\pi$」。「$\omega_c = 0.05\pi$」を押す。
Look at the group delay. The FIR version (grey dashed) has a constant group delay of 0.5. The IIR version near DC has看群延遲。FIR 版本(灰色虛線)的群延遲固定為 0.5。IIR 版本在 DC 附近的群延遲是群遅延を見る。FIR 版(灰色の破線)の群遅延は 0.5 で一定である。IIR 版の直流付近の群遅延は
$$\tau_g(0)=\frac12+\frac{\alpha}{1-\alpha}$$and it falls with frequency. At $\omega_c=0.05\pi$ ($\alpha\approx0.854$) the DC delay is about 6.4 samples while the high-frequency delay is near 0. This is the IIR price mentioned earlier: the phase is not linear. Different passband frequencies are delayed by different amounts, which is phase distortion, and it grows as the pole approaches the unit circle and the cutoff drops.並隨頻率下降。$\omega_c=0.05\pi$($\alpha\approx0.854$)時,DC 的群延遲約 6.4 個樣本,高頻卻接近 0。這正是前面說的 IIR 代價:相位不是線性的。通帶內不同頻率的延遲不同,會造成相位失真。極點越靠近單位圓,截止越低,這個現象越明顯。であり、周波数とともに下がる。$\omega_c=0.05\pi$($\alpha\approx0.854$)では直流の遅れが約 6.4 標本なのに、高域ではほぼ 0 である。これが先に述べた IIR の代償、位相が線形でないことである。通過帯域内で周波数ごとに遅れが異なり、位相ひずみを生む。極が単位円に近づき遮断周波数が下がるほど、この現象は目立つ。
| FIR two-point averageFIR 2 點平均FIR 2 点平均 | First-order IIR lowpassIIR 一階低通1 次 IIR 低域通過 | |
|---|---|---|
| Transfer function轉移函數伝達関数 | $\tfrac12(1+z^{-1})$ | $\dfrac{1-\alpha}{2}\cdot\dfrac{1+z^{-1}}{1-\alpha z^{-1}}$ |
| Cutoff截止頻率遮断周波数 | fixed at $\pi/2$固定為 $\pi/2$$\pi/2$ に固定 | anywhere: $\alpha=\dfrac{1-\sin\omega_c}{\cos\omega_c}$可任意指定:$\alpha=\dfrac{1-\sin\omega_c}{\cos\omega_c}$任意:$\alpha=\dfrac{1-\sin\omega_c}{\cos\omega_c}$ |
| Operations per sample每個樣本的運算1 標本あたりの演算 | 1 add, 1 multiply1 次加法、1 次乘法加算 1、乗算 1 | one more add and multiply (feedback)多 1 次乘法和 1 次加法(回授)加算と乗算が 1 回ずつ増える(帰還) |
| Stability穩定性安定性 | always stable一定穩定常に安定 | requires $|\alpha|<1$需要 $|\alpha|<1$$|\alpha|<1$ が必要 |
| Phase相位位相 | linear, $\tau_g=\tfrac12$線性,$\tau_g=\tfrac12$線形、$\tau_g=\tfrac12$ | nonlinear, larger delay near DC非線性,DC 附近延遲較大非線形で、直流付近の遅れが大きい |
Same pole, but the zero moves to $z=+1$: now DC is blocked and $\omega=\pi$ has unit gain. The same $\alpha \leftrightarrow \omega_c$ relation holds, so one design formula serves both filters.極點相同,但零點移到 $z=+1$:現在直流被擋掉,而 $\omega=\pi$ 的增益為 1。同樣的 $\alpha \leftrightarrow \omega_c$ 關係依然成立,所以一條設計公式就能同時服務兩個濾波器。極は同じで、零点が $z=+1$ に移る。こうすると直流が遮断され、$\omega=\pi$ の利得が 1 になる。$\alpha \leftrightarrow \omega_c$ の関係はそのまま成り立つので、一つの設計式で両方のフィルタをまかなえる。
A bandpass filter(帶通濾波器)needs zeros at both $\omega=0$ and $\omega=\pi$ and a resonant pole pair near the center frequency $\omega_0$:帶通濾波器需要在 $\omega=0$ 與 $\omega=\pi$ 兩處都有零點,並在中心頻率 $\omega_0$ 附近放一對共振的極點:帯域通過フィルタには、$\omega=0$ と $\omega=\pi$ の両方に零点が必要で、さらに中心周波数 $\omega_0$ の近くに共振する極の対が要る。
The two parameters decouple beautifully: $\beta$ sets where the peak is ($|H_{BP}(e^{j\omega_0})|=1$ exactly), while $\alpha$ sets how narrow it is. Stability requires $|\alpha|<1$ and $|\beta|<1$.這兩個參數漂亮地解耦了:$\beta$ 決定峰值在哪裡(而且 $|H_{BP}(e^{j\omega_0})|=1$ 恰好成立),$\alpha$ 則決定峰值有多窄。穩定性要求 $|\alpha|<1$ 與 $|\beta|<1$。二つの母数は見事に分離している。$\beta$ がピークの位置を決め(このとき $|H_{BP}(e^{j\omega_0})|=1$ がちょうど成り立つ)、$\alpha$ が鋭さを決める。安定であるためには $|\alpha|<1$ と $|\beta|<1$ が必要である。
Now the zeros sit on the unit circle at $e^{\pm j\omega_0}$ with $\omega_0=\cos^{-1}\beta$, so the gain is exactly zero at the notch frequency(陷波頻率)— the classic tool for removing power-line hum(去除電源雜訊). The same $\alpha$ formula gives the 3-dB notch width, and with matching parameters $H_{BP}(z)+H_{BS}(z)=1$: another doubly complementary pair.現在零點就落在單位圓上的 $e^{\pm j\omega_0}$,其中 $\omega_0=\cos^{-1}\beta$,因此陷波頻率上的增益恰好是零——這正是去除電源哼聲的經典工具。同一條 $\alpha$ 公式給出 3-dB 陷波寬度;參數彼此配合時還有 $H_{BP}(z)+H_{BS}(z)=1$:又是一對雙重互補的濾波器。今度は零点が単位円上の $e^{\pm j\omega_0}$ にあり、$\omega_0=\cos^{-1}\beta$ である。したがってノッチ周波数では利得がちょうど零になる。電源ハムを除去する古典的な道具である。3-dB のノッチ幅は同じ $\alpha$ の式で与えられ、母数をそろえれば $H_{BP}(z)+H_{BS}(z)=1$ も成り立つ。これもまた二重に相補な組である。
A single first-order section rolls off slowly. The cheapest way to sharpen it is to cascade(串接)identical copies: overall $H(z)=G_1(z)G_2(z)\cdots G_K(z)$, magnitudes multiply, dB curves add.單一個一階區段的滾降很慢。要讓它變陡,最便宜的辦法就是把相同的複本串接起來:整體 $H(z)=G_1(z)G_2(z)\cdots G_K(z)$,振幅相乘,dB 曲線相加。1 次のセクション一つでは減衰の傾きが緩い。これを急峻にする最も安価な方法は、同じものを縦続接続することである。全体では $H(z)=G_1(z)G_2(z)\cdots G_K(z)$ となり、振幅は掛け算、dB の曲線は足し算になる。
Cascading $K$ copies of the two-point average gives $H(z)=\bigl[\tfrac12(1+z^{-1})\bigr]^K$ with magnitude $\cos^K(\omega/2)$. The stopband improves dramatically — at $\omega=3\pi/4$ one section gives −8.3 dB but four sections give −33 dB — yet there is a price: the passband shrinks too.把兩點平均串接 $K$ 份,就得到 $H(z)=\bigl[\tfrac12(1+z^{-1})\bigr]^K$,振幅為 $\cos^K(\omega/2)$。阻帶改善得非常顯著——在 $\omega=3\pi/4$ 處,一段只有 −8.3 dB,四段卻有 −33 dB——但也有代價:通帶跟著縮小了。2 点平均を $K$ 個縦続すると $H(z)=\bigl[\tfrac12(1+z^{-1})\bigr]^K$ となり、振幅は $\cos^K(\omega/2)$ である。阻止帯域は劇的に改善し、$\omega=3\pi/4$ では 1 段で −8.3 dB、4 段では −33 dB になる。ただし代償があり、通過帯域も一緒に狭くなる。
An ideal filter(理想濾波器)has unit gain in the passband, zero gain in the stopband, and an instantaneous transition between them — a "brick wall"(磚牆式)response. The four classical types, on $0\le\omega\le\pi$ (responses are even in $\omega$ and $2\pi$-periodic):理想濾波器在通帶的增益為 1、在阻帶的增益為 0,而且兩者之間是瞬間過渡——也就是「磚牆」式的響應。以下是定義在 $0\le\omega\le\pi$ 上的四種經典型式(響應對 $\omega$ 是偶函數,並以 $2\pi$ 為週期):理想フィルタは通過帯域で利得 1、阻止帯域で利得 0 をもち、その間の遷移は瞬時である——いわゆる「ブリックウォール」応答である。$0\le\omega\le\pi$ 上での古典的な四つの型式は次のとおりである(応答は $\omega$ について偶関数で、周期は $2\pi$)。
Take the inverse DTFT of the ideal lowpass response $H_{LP}(e^{j\omega})=1$ for $|\omega|\le\omega_c$, $0$ otherwise:對理想低通響應取反 DTFT:$|\omega|\le\omega_c$ 時 $H_{LP}(e^{j\omega})=1$,其餘為 $0$:理想低域通過応答、すなわち $|\omega|\le\omega_c$ で $H_{LP}(e^{j\omega})=1$、それ以外では $0$ となる応答の逆 DTFT をとる。
Since brick walls are impossible, a practical lowpass spec relaxes the ideal in three ways: allow a small passband ripple(通帶漣波)$\delta_p$, allow a small nonzero stopband level(阻帶漣波)$\delta_s$, and insert a transition band(過渡帶)between the passband edge $\omega_p$ and stopband edge $\omega_s$ where the response is unconstrained:既然磚牆做不到,實務上的低通規格就從三個方向放寬理想:容許一點點通帶漣波 $\delta_p$,容許阻帶有一點不為零的阻帶位準 $\delta_s$,並在通帶邊界 $\omega_p$ 與阻帶邊界 $\omega_s$ 之間插入一段響應不受限制的過渡帶:ブリックウォールが不可能である以上、実用的な低域通過の仕様は理想を三つの方向に緩める。わずかな通過帯域リップル $\delta_p$ を許し、零でない小さな阻止帯域の水準 $\delta_s$ を許し、そして通過帯域端 $\omega_p$ と阻止帯域端 $\omega_s$ のあいだに、応答が拘束されない遷移帯域を挟むのである。
Specifications are usually quoted in dB:規格通常以 dB 表示:仕様はふつう dB で示される。
For example $\delta_s=0.01$ means $A_s=40$ dB; $\delta_p=0.05$ means $R_p\approx0.45$ dB. (An alternative convention quotes the total passband swing $20\log_{10}\frac{1+\delta_p}{1-\delta_p}$ — read the problem statement carefully.) A complete lowpass specification is then the quadruple $(\omega_p,\ \omega_s,\ \delta_p,\ \delta_s)$, or equivalently $(\omega_p,\ \omega_s,\ R_p,\ A_s)$. The filter design problem of the coming chapters is: find the lowest-order filter whose response stays inside the template.舉例來說,$\delta_s=0.01$ 代表 $A_s=40$ dB;$\delta_p=0.05$ 代表 $R_p\approx0.45$ dB。(另一種慣例是用通帶的總擺幅 $20\log_{10}\frac{1+\delta_p}{1-\delta_p}$ 來表示——題目要看清楚。)於是一份完整的低通規格就是四元組 $(\omega_p,\ \omega_s,\ \delta_p,\ \delta_s)$,或等價地寫成 $(\omega_p,\ \omega_s,\ R_p,\ A_s)$。接下來幾章的濾波器設計問題就是:找出響應仍落在樣板之內、階數最低的那個濾波器。たとえば $\delta_s=0.01$ は $A_s=40$ dB を、$\delta_p=0.05$ は $R_p\approx0.45$ dB を意味する。(別の慣例では通過帯域の全振れ幅 $20\log_{10}\frac{1+\delta_p}{1-\delta_p}$ を示すので、問題文をよく読むこと。)完全な低域通過の仕様は四つ組 $(\omega_p,\ \omega_s,\ \delta_p,\ \delta_s)$、あるいは同じことだが $(\omega_p,\ \omega_s,\ R_p,\ A_s)$ である。以降の章のフィルタ設計問題とは、応答がテンプレートの内側に収まる最低次数のフィルタを見つけることにほかならない。
Magnitude is only half the story. If the phase response $\angle H(e^{j\omega})$ is not linear in $\omega$, different frequency components experience different delays — the group delay(群延遲)$\tau(\omega)=-\,d\angle H/d\omega$ varies — and the waveform is smeared even when all magnitudes are untouched. This phase distortion(相位失真)is fatal in applications that care about waveform shape (ECG, seismic data, images, data pulses).振幅只說了一半的故事。如果相位響應 $\angle H(e^{j\omega})$ 對 $\omega$ 不是線性的,不同頻率成分就會有不同的延遲——群延遲 $\tau(\omega)=-\,d\angle H/d\omega$ 會隨頻率改變——即使所有振幅都原封不動,波形仍然被抹散。這種相位失真在重視波形形狀的應用(心電圖、地震資料、影像、資料脈衝)裡是致命的。振幅は話の半分にすぎない。位相応答 $\angle H(e^{j\omega})$ が $\omega$ について線形でないと、周波数成分ごとに遅延が変わり——群遅延 $\tau(\omega)=-\,d\angle H/d\omega$ が一定でなくなり——振幅をいっさい変えなくても波形は崩れる。この位相歪みは、波形の形そのものが問題になる用途(心電図、地震データ、画像、データパルス)では致命的である。
Every frequency is delayed by the same $D$ samples: the output is a filtered, shifted, but unsmeared copy of the input.每個頻率都被延遲同樣的 $D$ 個樣本:輸出是輸入經過濾波、平移、但沒有被抹散的複本。どの周波数も同じ $D$ 標本だけ遅れる。出力は、フィルタを通って平行移動したが崩れてはいない入力の複製である。
For offline data there is an elegant trick. Filter the signal, time-reverse the result, filter again, and reverse once more. Each pass contributes $H(e^{j\omega})$ once with a conjugation, so the overall response is對離線資料有一個漂亮的小技巧:先濾波,把結果在時間上反轉,再濾一次,然後再反轉回來。每一趟都貢獻一次 $H(e^{j\omega})$ 並附帶一次共軛,所以整體響應是オフラインのデータには洗練された技がある。信号をフィルタにかけ、結果を時間反転し、もう一度フィルタにかけ、さらに反転して戻す。各パスが $H(e^{j\omega})$ を一度ずつ共役つきで寄与するので、全体の応答は次のようになる。
— real and nonnegative: exactly zero phase, with the magnitude squared (doubling attenuation in dB). This is MATLAB's filtfilt. The catch: the procedure is noncausal, so it only works on recorded (finite, stored) signals, not in real time(僅適用於離線資料,無法即時處理).——實數且非負:完全零相位,而且振幅被平方(以 dB 計算時衰減加倍)。這就是 MATLAB 的 filtfilt。但有個陷阱:這個程序是非因果的,所以只能用在錄好的(有限、已儲存的)訊號上,無法即時處理。——これは実数かつ非負であり、厳密にゼロ位相で、振幅は二乗される(dB での減衰は倍になる)。MATLAB の filtfilt がこれである。ただし落とし穴があり、この手順は非因果的なので、記録済みの(有限で保存された)信号にしか使えず、実時間処理はできない。
A causal length-$N$ FIR filter $h[n]$, $n=0,\dots,N-1$, has (generalized) linear phase if and only if its impulse response is symmetric or antisymmetric about its midpoint:一個長度為 $N$ 的因果 FIR 濾波器 $h[n]$($n=0,\dots,N-1$),具有(廣義)線性相位的充分必要條件,是它的脈衝響應對中點對稱或反對稱:長さ $N$ の因果的 FIR フィルタ $h[n]$($n=0,\dots,N-1$)が(一般化)線形位相をもつのは、そのインパルス応答が中点に関して対称または反対称であるとき、かつそのときに限る。
with $A(\omega)$ real (the amplitude response) and constant group delay $\tau=(N-1)/2$ samples. Two symmetry choices times two length parities give exactly four types:其中 $A(\omega)$ 是實數(稱為振幅響應),群延遲固定為 $\tau=(N-1)/2$ 個樣本。兩種對稱性乘上兩種長度奇偶,恰好給出四種型式:ここで $A(\omega)$ は実数(振幅応答と呼ぶ)であり、群遅延は $\tau=(N-1)/2$ 標本で一定である。対称性の 2 通りと長さの偶奇 2 通りを掛けると、ちょうど四つの型式が得られる。
| Type型式型式 | Symmetry對稱性対称性 | Length $N$長度 $N$長さ $N$ | Group delay $\frac{N-1}{2}$群延遲 $\frac{N-1}{2}$群遅延 $\frac{N-1}{2}$ | Forced zeros強制零點強制される零点 | Can realize可以實現実現できる応答 |
|---|---|---|---|---|---|
| 1 | symmetric $h[n]=h[N{-}1{-}n]$對稱 $h[n]=h[N{-}1{-}n]$対称 $h[n]=h[N{-}1{-}n]$ | odd奇數奇数 | integer整數整数 | none無なし | LP, HP, BP, BS — anythingLP、HP、BP、BS——什麼都行LP・HP・BP・BS——何でも可 |
| 2 | symmetric對稱対称 | even偶數偶数 | half-integer半整數半整数 | $z=-1$ ($\omega=\pi$) | LP, BP (not HP, not BS)LP、BP(不能做 HP、BS)LP・BP(HP と BS は不可) |
| 3 | antisymmetric $h[n]=-h[N{-}1{-}n]$反對稱 $h[n]=-h[N{-}1{-}n]$反対称 $h[n]=-h[N{-}1{-}n]$ | odd奇數奇数 | integer整數整数 | $z=+1$ and $z=-1$$z=+1$ 與 $z=-1$$z=+1$ と $z=-1$ | BP, differentiator, HilbertBP、微分器、希爾伯特轉換器BP・微分器・ヒルベルト変換器 |
| 4 | antisymmetric反對稱反対称 | even偶數偶数 | half-integer半整數半整数 | $z=+1$ ($\omega=0$) | HP, BP, differentiator, HilbertHP、BP、微分器、希爾伯特轉換器HP・BP・微分器・ヒルベルト変換器 |
The structural zeros in the table follow directly from the symmetry. Evaluate $H(z)=\sum h[n]z^{-n}$ at $z=\pm1$:表中的結構性零點可以直接由對稱性推得。把 $H(z)=\sum h[n]z^{-n}$ 代入 $z=\pm1$:表に現れる構造的な零点は、対称性から直ちに従う。$H(z)=\sum h[n]z^{-n}$ を $z=\pm1$ で評価してみよう。
Lowpass $\tfrac12(1+z^{-1})$: $|H|=\cos\frac\omega2$, zero at $\pi$. Highpass $\tfrac12(1-z^{-1})$: $|H|=\sin\frac\omega2$, zero at DC. Both cut off at $\pi/2$; $M$-point moving average generalizes the LP with nulls at $2\pi k/M$.低通 $\tfrac12(1+z^{-1})$:$|H|=\cos\frac\omega2$,零點在 $\pi$。高通 $\tfrac12(1-z^{-1})$:$|H|=\sin\frac\omega2$,零點在直流。兩者的截止頻率都是 $\pi/2$;$M$ 點移動平均把低通推廣,零點落在 $2\pi k/M$。低域通過 $\tfrac12(1+z^{-1})$ は $|H|=\cos\frac\omega2$ で零点は $\pi$、高域通過 $\tfrac12(1-z^{-1})$ は $|H|=\sin\frac\omega2$ で零点は直流にある。どちらも遮断は $\pi/2$ である。$M$ 点移動平均は低域通過を一般化したもので、零点は $2\pi k/M$ に並ぶ。
First-order LP/HP with pole $\alpha$: $\alpha=\frac{1-\sin\omega_c}{\cos\omega_c}$ sets the 3-dB cutoff. Second-order BP/BS: $\beta=\cos\omega_0$ sets the center/notch, $\cos B_w=\frac{2\alpha}{1+\alpha^2}$ sets the width. Matching pairs satisfy $H_1+H_2=1$ and $|H_1|^2+|H_2|^2=1$.一階 LP/HP 的極點為 $\alpha$:$\alpha=\frac{1-\sin\omega_c}{\cos\omega_c}$ 決定 3-dB 截止頻率。二階 BP/BS:$\beta=\cos\omega_0$ 決定中心或陷波位置,$\cos B_w=\frac{2\alpha}{1+\alpha^2}$ 決定寬度。參數彼此配合的一對滿足 $H_1+H_2=1$ 與 $|H_1|^2+|H_2|^2=1$。1 次 LP/HP は極 $\alpha$ をもち、$\alpha=\frac{1-\sin\omega_c}{\cos\omega_c}$ が 3-dB 遮断周波数を決める。2 次 BP/BS では $\beta=\cos\omega_0$ が中心(ノッチ)の位置を、$\cos B_w=\frac{2\alpha}{1+\alpha^2}$ が幅を決める。母数をそろえた組は $H_1+H_2=1$ と $|H_1|^2+|H_2|^2=1$ を満たす。
Gain $=20\log_{10}|H|$ dB; $-3$ dB $=$ half power $=1/\sqrt2$ amplitude. Cascading: magnitudes multiply, dB add — stopband deepens but the passband narrows.增益 $=20\log_{10}|H|$ dB;$-3$ dB $=$ 半功率 $=1/\sqrt2$ 的振幅。串接時振幅相乘、dB 相加——阻帶更深,但通帶也更窄。利得は $=20\log_{10}|H|$ dB、$-3$ dB $=$ 半電力 $=1/\sqrt2$ の振幅である。縦続接続では振幅が掛け算、dB が足し算になり、阻止帯域は深くなるが通過帯域は狭くなる。
Brick-wall LP/HP/BP/BS. Ideal LP has $h[n]=\frac{\sin\omega_c n}{\pi n}$: noncausal, infinite, not absolutely summable ⇒ unrealizable; real filters only approximate it.磚牆式的 LP/HP/BP/BS。理想 LP 的 $h[n]=\frac{\sin\omega_c n}{\pi n}$:非因果、無限長、不絕對可和 ⇒ 不可實現;真實的濾波器只能逼近它。ブリックウォールの LP/HP/BP/BS。理想 LP は $h[n]=\frac{\sin\omega_c n}{\pi n}$ であり、非因果的・無限長・絶対総和可能でない ⇒ 実現不可能である。実際のフィルタはこれを近似するだけである。
Spec $=(\omega_p,\omega_s,\delta_p,\delta_s)$: passband within $1\pm\delta_p$, stopband below $\delta_s$, free transition band. In dB: $R_p=-20\log_{10}(1-\delta_p)$, $A_s=-20\log_{10}\delta_s$.規格 $=(\omega_p,\omega_s,\delta_p,\delta_s)$:通帶落在 $1\pm\delta_p$ 之內,阻帶低於 $\delta_s$,過渡帶自由。以 dB 表示:$R_p=-20\log_{10}(1-\delta_p)$、$A_s=-20\log_{10}\delta_s$。仕様は $=(\omega_p,\omega_s,\delta_p,\delta_s)$ である。通過帯域は $1\pm\delta_p$ の内側、阻止帯域は $\delta_s$ 以下、遷移帯域は自由。dB では $R_p=-20\log_{10}(1-\delta_p)$、$A_s=-20\log_{10}\delta_s$ となる。
$h[n]=\pm h[N{-}1{-}n]$ ⇒ constant group delay $\frac{N-1}{2}$. Type 1 (sym, odd): anything. Type 2 (sym, even): no HP/BS. Type 3 (antisym, odd): zeros at $0$ and $\pi$. Type 4 (antisym, even): no LP/BS. Offline zero phase: filtfilt ⇒ $|H|^2$.$h[n]=\pm h[N{-}1{-}n]$ ⇒ 群延遲固定為 $\frac{N-1}{2}$。型式 1(對稱、奇數):什麼都能做。型式 2(對稱、偶數):不能做 HP/BS。型式 3(反對稱、奇數):在 $0$ 與 $\pi$ 處有零點。型式 4(反對稱、偶數):不能做 LP/BS。離線的零相位:filtfilt ⇒ $|H|^2$。$h[n]=\pm h[N{-}1{-}n]$ ⇒ 群遅延は $\frac{N-1}{2}$ で一定。型式 1(対称・奇数)は何でも可。型式 2(対称・偶数)は HP/BS が不可。型式 3(反対称・奇数)は $0$ と $\pi$ に零点。型式 4(反対称・偶数)は LP/BS が不可。オフラインのゼロ位相は filtfilt ⇒ $|H|^2$。
Problem: Consider the filters $H_0(z)=\tfrac12(1+z^{-1})$ and $H_1(z)=\tfrac12(1-z^{-1})$. (a) Derive the magnitude and phase responses of both filters. (b) Find the 3-dB cutoff frequency of each. (c) Show that the pair is power-complementary. (d) What is the gain of $H_0$ in dB at $\omega = 3\pi/4$?題目:考慮濾波器 $H_0(z)=\tfrac12(1+z^{-1})$ 與 $H_1(z)=\tfrac12(1-z^{-1})$。(a)推導兩個濾波器的振幅響應與相位響應。(b)求出各自的 3-dB 截止頻率。(c)證明這一對是功率互補的。(d)在 $\omega = 3\pi/4$ 處,$H_0$ 的增益是多少 dB?問題:フィルタ $H_0(z)=\tfrac12(1+z^{-1})$ と $H_1(z)=\tfrac12(1-z^{-1})$ を考える。(a) 両方のフィルタの振幅応答と位相応答を導け。(b) それぞれの 3-dB 遮断周波数を求めよ。(c) この組が電力相補であることを示せ。(d) $\omega = 3\pi/4$ における $H_0$ の利得は何 dB か。
(a) Factor out the half-sample delay:(a) 把半個樣本的延遲提出來:(a) 半標本ぶんの遅延をくくり出す。
$$H_0(e^{j\omega})=\tfrac12\bigl(1+e^{-j\omega}\bigr)=e^{-j\omega/2}\,\frac{e^{j\omega/2}+e^{-j\omega/2}}{2}=e^{-j\omega/2}\cos\tfrac\omega2$$ $$H_1(e^{j\omega})=\tfrac12\bigl(1-e^{-j\omega}\bigr)=e^{-j\omega/2}\,\frac{e^{j\omega/2}-e^{-j\omega/2}}{2}=j\,e^{-j\omega/2}\sin\tfrac\omega2$$So $|H_0|=\cos\frac\omega2$, $\angle H_0=-\frac\omega2$; and $|H_1|=\sin\frac\omega2$ (for $0\le\omega\le\pi$), $\angle H_1=\frac\pi2-\frac\omega2$. Both have linear phase (Types 2 and 4 respectively).於是 $|H_0|=\cos\frac\omega2$、$\angle H_0=-\frac\omega2$;而 $|H_1|=\sin\frac\omega2$(在 $0\le\omega\le\pi$ 範圍內)、$\angle H_1=\frac\pi2-\frac\omega2$。兩者都具有線性相位(分別是型式 2 與型式 4)。よって $|H_0|=\cos\frac\omega2$、$\angle H_0=-\frac\omega2$ であり、$|H_1|=\sin\frac\omega2$($0\le\omega\le\pi$ の範囲)、$\angle H_1=\frac\pi2-\frac\omega2$ である。どちらも線形位相をもつ(それぞれ型式 2 と型式 4)。
(b) $\cos\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$; likewise $\sin\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$. Same cutoff — they split the band evenly.(b) $\cos\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$;同樣地 $\sin\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$。截止頻率相同——兩者把整個頻帶平分了。(b) $\cos\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$、同様に $\sin\frac{\omega_c}2=\frac1{\sqrt2}\Rightarrow\omega_c=\frac\pi2$。遮断周波数は同じであり、両者は帯域をちょうど半分ずつに分ける。
(c) $|H_0|^2+|H_1|^2=\cos^2\frac\omega2+\sin^2\frac\omega2=1$ for all $\omega$. $\blacksquare$(c) 對所有 $\omega$ 都有 $|H_0|^2+|H_1|^2=\cos^2\frac\omega2+\sin^2\frac\omega2=1$。$\blacksquare$(c) すべての $\omega$ について $|H_0|^2+|H_1|^2=\cos^2\frac\omega2+\sin^2\frac\omega2=1$ が成り立つ。$\blacksquare$
(d) $|H_0(e^{j3\pi/4})|=\cos\frac{3\pi}8=0.3827$, so the gain is $20\log_{10}0.3827=-8.34$ dB.(d) $|H_0(e^{j3\pi/4})|=\cos\frac{3\pi}8=0.3827$,所以增益是 $20\log_{10}0.3827=-8.34$ dB。(d) $|H_0(e^{j3\pi/4})|=\cos\frac{3\pi}8=0.3827$ なので、利得は $20\log_{10}0.3827=-8.34$ dB である。
Problem: Design the first-order IIR lowpass $H_{LP}(z)=\frac{1-\alpha}{2}\cdot\frac{1+z^{-1}}{1-\alpha z^{-1}}$ with a 3-dB cutoff at $\omega_c=\pi/3$. (a) Find $\alpha$ and write out $H_{LP}(z)$ numerically and the difference equation. (b) Verify the gains at $\omega=0$, $\omega=\omega_c$, and $\omega=\pi$. (c) Write the corresponding highpass $H_{HP}(z)$ with the same cutoff and state the two complementarity relations linking the pair.題目:設計一階 IIR 低通 $H_{LP}(z)=\frac{1-\alpha}{2}\cdot\frac{1+z^{-1}}{1-\alpha z^{-1}}$,使 3-dB 截止頻率落在 $\omega_c=\pi/3$。(a)求 $\alpha$,並寫出 $H_{LP}(z)$ 的數值形式與差分方程式。(b)驗算 $\omega=0$、$\omega=\omega_c$ 與 $\omega=\pi$ 處的增益。(c)寫出截止頻率相同的對應高通 $H_{HP}(z)$,並說明連結這一對濾波器的兩個互補關係。問題:3-dB 遮断が $\omega_c=\pi/3$ となるように、1 次 IIR 低域通過 $H_{LP}(z)=\frac{1-\alpha}{2}\cdot\frac{1+z^{-1}}{1-\alpha z^{-1}}$ を設計せよ。(a) $\alpha$ を求め、$H_{LP}(z)$ を数値で、また差分方程式として書け。(b) $\omega=0$、$\omega=\omega_c$、$\omega=\pi$ における利得を検証せよ。(c) 遮断周波数が同じ高域通過 $H_{HP}(z)$ を書き、この組を結ぶ二つの相補関係を述べよ。
(a) With $\sin\frac\pi3=0.8660$, $\cos\frac\pi3=0.5$:(a) 由 $\sin\frac\pi3=0.8660$、$\cos\frac\pi3=0.5$ 得:(a) $\sin\frac\pi3=0.8660$、$\cos\frac\pi3=0.5$ より、
$$\alpha=\frac{1-\sin\omega_c}{\cos\omega_c}=\frac{1-0.8660}{0.5}=0.2679$$ $$H_{LP}(z)=0.3660\,\frac{1+z^{-1}}{1-0.2679\,z^{-1}} \qquad y[n]=0.2679\,y[n-1]+0.3660\,x[n]+0.3660\,x[n-1]$$(b) At $\omega=0$: $H=0.3660\cdot\frac{2}{1-0.2679}=\frac{0.7321}{0.7321}=1$ (0 dB). At $\omega=\pi$: numerator $1+e^{-j\pi}=0$, so $H=0$ ($-\infty$ dB). At $\omega_c=\pi/3$: by construction of the $\alpha$ formula, $|H|=1/\sqrt2$ ($-3$ dB); direct substitution $z=e^{j\pi/3}$ confirms $|H|=0.7071$.(b) 在 $\omega=0$:$H=0.3660\cdot\frac{2}{1-0.2679}=\frac{0.7321}{0.7321}=1$(0 dB)。在 $\omega=\pi$:分子 $1+e^{-j\pi}=0$,所以 $H=0$($-\infty$ dB)。在 $\omega_c=\pi/3$:由 $\alpha$ 公式的構造可知 $|H|=1/\sqrt2$($-3$ dB);直接代入 $z=e^{j\pi/3}$ 也確認 $|H|=0.7071$。(b) $\omega=0$ では $H=0.3660\cdot\frac{2}{1-0.2679}=\frac{0.7321}{0.7321}=1$(0 dB)。$\omega=\pi$ では分子が $1+e^{-j\pi}=0$ となるので $H=0$($-\infty$ dB)。$\omega_c=\pi/3$ では $\alpha$ の式の作り方から $|H|=1/\sqrt2$($-3$ dB)であり、$z=e^{j\pi/3}$ を直接代入しても $|H|=0.7071$ が確かめられる。
(c) $H_{HP}(z)=\dfrac{1+\alpha}{2}\cdot\dfrac{1-z^{-1}}{1-\alpha z^{-1}}=0.6340\,\dfrac{1-z^{-1}}{1-0.2679\,z^{-1}}$. The pair is delay-complementary, $H_{LP}(z)+H_{HP}(z)=1$, and power-complementary, $|H_{LP}(e^{j\omega})|^2+|H_{HP}(e^{j\omega})|^2=1$ — so the highpass output can be computed as $x[n]-y_{LP}[n]$.(c) $H_{HP}(z)=\dfrac{1+\alpha}{2}\cdot\dfrac{1-z^{-1}}{1-\alpha z^{-1}}=0.6340\,\dfrac{1-z^{-1}}{1-0.2679\,z^{-1}}$。這一對是延遲互補的,$H_{LP}(z)+H_{HP}(z)=1$,也是功率互補的,$|H_{LP}(e^{j\omega})|^2+|H_{HP}(e^{j\omega})|^2=1$——所以高通的輸出可以直接用 $x[n]-y_{LP}[n]$ 算出來。(c) $H_{HP}(z)=\dfrac{1+\alpha}{2}\cdot\dfrac{1-z^{-1}}{1-\alpha z^{-1}}=0.6340\,\dfrac{1-z^{-1}}{1-0.2679\,z^{-1}}$ である。この組は遅延相補 $H_{LP}(z)+H_{HP}(z)=1$ であり、かつ電力相補 $|H_{LP}(e^{j\omega})|^2+|H_{HP}(e^{j\omega})|^2=1$ でもある。したがって高域通過の出力は $x[n]-y_{LP}[n]$ として計算できる。
Problem: An ideal lowpass filter has $H(e^{j\omega})=1$ for $|\omega|\le0.3\pi$ and $0$ for $0.3\pi<|\omega|\le\pi$. (a) Derive its impulse response $h[n]$ and evaluate $h[0]$, $h[1]$, $h[5]$. (b) Give three independent reasons why this filter cannot be implemented. (c) If we tolerate a delay, can a sufficiently long causal FIR filter implement it exactly? Explain.題目:某理想低通濾波器在 $|\omega|\le0.3\pi$ 時 $H(e^{j\omega})=1$,在 $0.3\pi<|\omega|\le\pi$ 時為 $0$。(a)推導它的脈衝響應 $h[n]$,並算出 $h[0]$、$h[1]$、$h[5]$。(b)給出三個互相獨立的理由,說明這個濾波器為何無法實作。(c)如果我們願意容忍延遲,夠長的因果 FIR 濾波器能否精確實作它?請說明。問題:理想低域通過フィルタが $|\omega|\le0.3\pi$ で $H(e^{j\omega})=1$、$0.3\pi<|\omega|\le\pi$ で $0$ であるとする。(a) インパルス応答 $h[n]$ を導き、$h[0]$、$h[1]$、$h[5]$ を求めよ。(b) このフィルタが実装できない理由を、互いに独立に三つ挙げよ。(c) 遅延を許すなら、十分に長い因果的 FIR フィルタでこれを厳密に実装できるか。理由を述べよ。
(a) Inverse DTFT over the passband only:(a) 只在通帶上取反 DTFT:(a) 通過帯域だけで逆 DTFT をとる。
$$h[n]=\frac1{2\pi}\int_{-0.3\pi}^{0.3\pi}e^{j\omega n}\,d\omega =\frac{e^{j0.3\pi n}-e^{-j0.3\pi n}}{2\pi jn} =\frac{\sin(0.3\pi n)}{\pi n}$$Values: $h[0]=\dfrac{\omega_c}{\pi}=0.3$; $h[1]=\dfrac{\sin 0.3\pi}{\pi}=\dfrac{0.8090}{3.1416}=0.2575$; $h[5]=\dfrac{\sin 1.5\pi}{5\pi}=\dfrac{-1}{15.708}=-0.0637$.數值:$h[0]=\dfrac{\omega_c}{\pi}=0.3$;$h[1]=\dfrac{\sin 0.3\pi}{\pi}=\dfrac{0.8090}{3.1416}=0.2575$;$h[5]=\dfrac{\sin 1.5\pi}{5\pi}=\dfrac{-1}{15.708}=-0.0637$。値は $h[0]=\dfrac{\omega_c}{\pi}=0.3$、$h[1]=\dfrac{\sin 0.3\pi}{\pi}=\dfrac{0.8090}{3.1416}=0.2575$、$h[5]=\dfrac{\sin 1.5\pi}{5\pi}=\dfrac{-1}{15.708}=-0.0637$ である。
(b) (1) Noncausal: $h[-1]=h[1]\ne0$ — it needs future inputs. (2) Infinite duration: $h[n]\ne0$ for arbitrarily large $|n|$, so no finite implementation exists. (3) Unstable in the BIBO sense: $|h[n]|\sim\frac1{\pi|n|}$ and the harmonic series diverges, so $\sum_n|h[n]|=\infty$.(b)(1)非因果:$h[-1]=h[1]\ne0$——它需要未來的輸入。(2)長度無限:對任意大的 $|n|$ 都有 $h[n]\ne0$,所以不存在有限的實作。(3)不是 BIBO 穩定:$|h[n]|\sim\frac1{\pi|n|}$,而調和級數發散,所以 $\sum_n|h[n]|=\infty$。(b) (1) 非因果的:$h[-1]=h[1]\ne0$ であり、未来の入力を必要とする。(2) 無限長:いくら大きな $|n|$ でも $h[n]\ne0$ なので、有限の実装は存在しない。(3) BIBO の意味で不安定:$|h[n]|\sim\frac1{\pi|n|}$ であり調和級数は発散するから $\sum_n|h[n]|=\infty$ となる。
(c) No. Delaying by $D$ and truncating to $0\le n\le N-1$ gives a causal FIR approximation $h[n-D]w[n]$, but truncation in time means convolving the brick wall with a sinc-like kernel in frequency: ripples (Gibbs phenomenon, ≈9% overshoot for rectangular truncation) and a nonzero transition band appear for every finite $N$. Exact realization would require all infinitely many taps. This is precisely why practical specs use the tolerance scheme of Section 11.5.3.(c) 不行。延遲 $D$ 再截斷到 $0\le n\le N-1$,得到的是因果 FIR 的近似 $h[n-D]w[n]$;但時域的截斷在頻域上等於把磚牆與一個類 sinc 的核做摺積:對每一個有限的 $N$,都會出現漣波(吉布斯現象,矩形截斷約有 9% 的過衝)以及不為零的過渡帶。要精確實現就得用上無窮多個抽頭。這正是實務規格採用 11.5.3 節那套容忍度規格圖的原因。(c) できない。$D$ だけ遅らせて $0\le n\le N-1$ に打ち切ると、因果的 FIR による近似 $h[n-D]w[n]$ が得られる。しかし時間領域での打ち切りは、周波数領域でブリックウォールを sinc 状の核と畳み込むことを意味する。どの有限の $N$ に対しても、リップル(ギブス現象。矩形打ち切りでは約 9% の行き過ぎ)と零でない遷移帯域が現れる。厳密に実現するには無限個のタップがすべて必要になる。実用の仕様が 11.5.3 節の許容仕様図を使うのは、まさにこのためである。
Problem: A lowpass filter must satisfy the tolerance scheme with $\omega_p=0.35\pi$, $\omega_s=0.5\pi$, $\delta_p=0.05$, $\delta_s=0.01$. (a) Compute the peak passband ripple $R_p$ and the minimum stopband attenuation $A_s$ in dB. (b) A different spec sheet demands $A_s = 60$ dB and $R_p = 0.2$ dB. Convert these back to $\delta_s$ and $\delta_p$. (c) The transition bandwidth is $\Delta\omega=\omega_s-\omega_p$. Qualitatively, what happens to the required filter order if $\Delta\omega$ is halved with tolerances unchanged?題目:某低通濾波器必須滿足容忍度規格 $\omega_p=0.35\pi$、$\omega_s=0.5\pi$、$\delta_p=0.05$、$\delta_s=0.01$。(a)計算以 dB 表示的峰值通帶漣波 $R_p$ 與最小阻帶衰減 $A_s$。(b)另一份規格書要求 $A_s = 60$ dB 與 $R_p = 0.2$ dB,請把它們換算回 $\delta_s$ 與 $\delta_p$。(c)過渡帶寬度為 $\Delta\omega=\omega_s-\omega_p$。在容忍度不變的情況下,若 $\Delta\omega$ 減半,所需的濾波器階數大致會如何變化?問題:ある低域通過フィルタが $\omega_p=0.35\pi$、$\omega_s=0.5\pi$、$\delta_p=0.05$、$\delta_s=0.01$ の許容仕様を満たさなければならない。(a) dB で表したピーク通過帯域リップル $R_p$ と最小阻止帯域減衰量 $A_s$ を求めよ。(b) 別の仕様書は $A_s = 60$ dB と $R_p = 0.2$ dB を要求している。これらを $\delta_s$ と $\delta_p$ に戻せ。(c) 遷移帯域幅は $\Delta\omega=\omega_s-\omega_p$ である。許容値を変えずに $\Delta\omega$ を半分にすると、必要なフィルタ次数は定性的にどうなるか。
(a)
$$R_p=-20\log_{10}(1-\delta_p)=-20\log_{10}0.95=0.446\ \text{dB} \qquad A_s=-20\log_{10}\delta_s=-20\log_{10}0.01=40\ \text{dB}$$(b) Invert the formulas:(b) 把公式反解回來:(b) 式を逆に解く。
$$\delta_s=10^{-A_s/20}=10^{-3}=0.001 \qquad \delta_p=1-10^{-R_p/20}=1-10^{-0.01}=1-0.97724=0.0228$$(c) The order grows roughly in inverse proportion to the transition width (for FIR designs, $N\propto A_s/\Delta\omega$ by standard estimates such as the Kaiser formula). Halving $\Delta\omega$ approximately doubles the required order — sharpness is the most expensive item in a filter spec.(c) 階數大致與過渡帶寬度成反比(對 FIR 設計而言,依 Kaiser 公式之類的標準估計有 $N\propto A_s/\Delta\omega$)。把 $\Delta\omega$ 減半,所需階數大約加倍——陡峭度是濾波器規格裡最昂貴的一項。(c) 次数はおおむね遷移帯域幅に反比例して増える(FIR 設計では Kaiser の式などの標準的な見積りにより $N\propto A_s/\Delta\omega$)。$\Delta\omega$ を半分にすると必要な次数はおよそ倍になる。急峻さはフィルタ仕様のなかで最も高くつく項目である。
Problem: A slow sinusoid $s[n]=2\sin(2\pi\cdot0.02\,n)$, $n=0,\dots,199$, is corrupted by white Gaussian noise of standard deviation $0.8$. In MATLAB, (a) filter the noisy signal with an $M=11$ point moving average and plot the input and output; (b) plot the filter's magnitude response and explain why $M=11$ works well here; (c) state the delay introduced and how to compensate it.題目:一個緩慢的弦波 $s[n]=2\sin(2\pi\cdot0.02\,n)$($n=0,\dots,199$)被標準差 $0.8$ 的白高斯雜訊汙染。請用 MATLAB:(a)以 $M=11$ 點的移動平均對含雜訊的訊號濾波,並畫出輸入與輸出;(b)畫出濾波器的振幅響應,說明為什麼 $M=11$ 在這裡效果很好;(c)說明引入了多少延遲,以及要如何補償。問題:ゆっくりした正弦波 $s[n]=2\sin(2\pi\cdot0.02\,n)$($n=0,\dots,199$)が、標準偏差 $0.8$ の白色ガウス雑音で汚されている。MATLAB で、(a) この雑音入り信号を $M=11$ 点の移動平均でフィルタし、入力と出力を描け。(b) フィルタの振幅応答を描き、なぜここで $M=11$ がうまく働くのかを説明せよ。(c) 生じる遅延と、その補償方法を述べよ。
(a) MATLAB code:(a) MATLAB 程式碼:(a) MATLAB のコード:
N = 200; n = (0:N-1).';
s = 2*sin(2*pi*0.02*n); % clean signal (f0 = 0.02 cycles/sample)
x = s + 0.8*randn(N,1); % noisy observation
M = 11;
b = ones(1,M)/M; % moving-average coefficients
y = filter(b, 1, x); % causal filtering, delay (M-1)/2 = 5
y_aligned = [y((M+1)/2:end); zeros((M-1)/2,1)]; % advance by 5 samples
subplot(2,1,1); plot(n, x, 'Color', [.5 .5 .5]); hold on;
plot(n, s, 'b', 'LineWidth', 1.5); legend('noisy x[n]','clean s[n]');
subplot(2,1,2); plot(n, y_aligned, 'r', 'LineWidth', 1.5); hold on;
plot(n, s, 'b--'); legend('filtered (aligned)','clean s[n]');
figure; % (b) magnitude response
[H, w] = freqz(b, 1, 1024);
plot(w/pi, abs(H)); grid on;
xlabel('\omega/\pi'); ylabel('|H(e^{j\omega})|');
Regenerated result (numpy/matplotlib, seed 11):重新產生的結果(numpy/matplotlib,種子 11):再生成した結果(numpy/matplotlib、シード 11):
(b) The signal lives at $\omega_0=2\pi\cdot0.02=0.04\pi$, deep inside the main lobe of the $M=11$ response (first null at $2\pi/11\approx0.18\pi$): its gain is $\bigl|\frac{\sin(11\omega_0/2)}{11\sin(\omega_0/2)}\bigr|\approx0.978$, i.e. a loss of only about 0.2 dB. The noise, by contrast, is spread uniformly over all $\omega$, and averaging $11$ independent samples cuts the noise power by a factor of $11$ ($\approx10.4$ dB). Hence: signal kept, noise reduced.(b) 訊號位於 $\omega_0=2\pi\cdot0.02=0.04\pi$,深深落在 $M=11$ 響應的主瓣之內(第一個零點在 $2\pi/11\approx0.18\pi$):它的增益是 $\bigl|\frac{\sin(11\omega_0/2)}{11\sin(\omega_0/2)}\bigr|\approx0.978$,也就是只損失大約 0.2 dB。相對地,雜訊均勻散佈在所有 $\omega$ 上,把 $11$ 個獨立樣本平均起來,雜訊功率就降為原來的 $11$ 分之一($\approx10.4$ dB)。於是訊號保住了,雜訊減少了。(b) 信号は $\omega_0=2\pi\cdot0.02=0.04\pi$ にあり、$M=11$ の応答のメインローブの奥深くに入っている(最初の零点は $2\pi/11\approx0.18\pi$)。その利得は $\bigl|\frac{\sin(11\omega_0/2)}{11\sin(\omega_0/2)}\bigr|\approx0.978$ で、損失はわずか 0.2 dB 程度である。一方、雑音はすべての $\omega$ に一様に広がっており、独立な $11$ 標本を平均すると雑音電力は $11$ 分の 1 になる($\approx10.4$ dB)。こうして信号は保たれ、雑音は減るのである。
(c) The filter is a Type-1 linear-phase FIR with group delay $(M-1)/2=5$ samples at every frequency, so the output is simply shifted by 5. Compensate by advancing the output 5 samples (as in the code), by plotting against $n-5$, or — offline — by using filtfilt, which yields zero phase and squares the magnitude response.(c) 這個濾波器是型式 1 的線性相位 FIR,在每個頻率上的群延遲都是 $(M-1)/2=5$ 個樣本,所以輸出只是整體平移了 5。補償的方法是把輸出往前移 5 個樣本(程式碼裡就是這麼做的)、改用 $n-5$ 當橫軸,或者——在離線的情況下——改用 filtfilt,它會給出零相位,並把振幅響應平方。(c) このフィルタは型式 1 の線形位相 FIR であり、群遅延はどの周波数でも $(M-1)/2=5$ 標本なので、出力は単に 5 だけずれる。補償するには、出力を 5 標本進めるか(コードではそうしている)、横軸を $n-5$ にして描くか、あるいはオフラインであれば filtfilt を使えばよい。これはゼロ位相を与え、振幅応答を二乗する。
Problem: A causal FIR filter has impulse response $h[n]=\{1,\,-2,\,0,\,2,\,-1\}$ for $n=0,\dots,4$. (a) Determine whether it has linear phase, and if so, which type and what group delay. (b) Compute $H(e^{j0})$ and $H(e^{j\pi})$ and confirm they agree with the structural zeros of that type. (c) Could this filter be used as a lowpass filter? A highpass? What applications suit it?題目:某因果 FIR 濾波器在 $n=0,\dots,4$ 上的脈衝響應為 $h[n]=\{1,\,-2,\,0,\,2,\,-1\}$。(a)判斷它是否具有線性相位;若有,是哪一種型式、群延遲是多少。(b)計算 $H(e^{j0})$ 與 $H(e^{j\pi})$,確認它們與該型式的結構性零點一致。(c)這個濾波器可以當低通用嗎?高通呢?什麼樣的應用適合它?問題:ある因果的 FIR フィルタのインパルス応答が $n=0,\dots,4$ に対して $h[n]=\{1,\,-2,\,0,\,2,\,-1\}$ であるとする。(a) 線形位相をもつかどうかを判定し、もつならどの型式か、群遅延はいくらかを答えよ。(b) $H(e^{j0})$ と $H(e^{j\pi})$ を計算し、その型式の構造的な零点と一致することを確かめよ。(c) このフィルタは低域通過として使えるか。高域通過ではどうか。どのような用途に向くか。
(a) Check $h[n]$ against $h[4-n]$: $h[0]=1$ vs $h[4]=-1$; $h[1]=-2$ vs $h[3]=2$; $h[2]=0$. So $h[n]=-h[4-n]$: antisymmetric with odd length $N=5$ — a Type 3 linear-phase filter (note the center sample $h[2]=0$, as Type 3 requires). Group delay $\tau=(N-1)/2=2$ samples, plus the constant $90^\circ$ phase factor $j$ of antisymmetric filters (generalized linear phase).(a) 把 $h[n]$ 與 $h[4-n]$ 比對:$h[0]=1$ 對上 $h[4]=-1$;$h[1]=-2$ 對上 $h[3]=2$;中間是 $h[2]=0$。所以 $h[n]=-h[4-n]$:反對稱且長度為奇數 $N=5$——這是型式 3 的線性相位濾波器(注意中心樣本 $h[2]=0$,正是型式 3 的要求)。群延遲 $\tau=(N-1)/2=2$ 個樣本,另外還要加上反對稱濾波器那個固定的 $90^\circ$ 相位因子 $j$(廣義線性相位)。(a) $h[n]$ と $h[4-n]$ を比べる。$h[0]=1$ に対し $h[4]=-1$、$h[1]=-2$ に対し $h[3]=2$、そして中央は $h[2]=0$ である。したがって $h[n]=-h[4-n]$ となり、長さが奇数 $N=5$ の反対称、すなわち型式 3 の線形位相フィルタである(中心の標本が $h[2]=0$ になっている点も型式 3 の要件どおり)。群遅延は $\tau=(N-1)/2=2$ 標本で、さらに反対称フィルタ特有の一定の $90^\circ$ 位相因子 $j$ がつく(一般化線形位相)。
(b) $H(e^{j0})=\sum_n h[n]=1-2+0+2-1=0$. $H(e^{j\pi})=\sum_n(-1)^n h[n]=h[0]-h[1]+h[2]-h[3]+h[4]=1+2+0-2-1=0$. Both are zero — exactly the forced zeros at $z=\pm1$ that define Type 3.(b) $H(e^{j0})=\sum_n h[n]=1-2+0+2-1=0$。$H(e^{j\pi})=\sum_n(-1)^n h[n]=h[0]-h[1]+h[2]-h[3]+h[4]=1+2+0-2-1=0$。兩者都是零——正是定義型式 3 的那組位於 $z=\pm1$ 的強制零點。(b) $H(e^{j0})=\sum_n h[n]=1-2+0+2-1=0$、$H(e^{j\pi})=\sum_n(-1)^n h[n]=h[0]-h[1]+h[2]-h[3]+h[4]=1+2+0-2-1=0$。どちらも零であり、まさに型式 3 を定義する $z=\pm1$ の強制零点である。
(c) With zero gain at both $\omega=0$ and $\omega=\pi$ it can be neither a lowpass nor a highpass (nor a bandstop) — passbands at the band edges are impossible. It is shaped for bandpass-like behavior; Type 3 structures are the natural home of differentiators and Hilbert transformers(微分器與希爾伯特轉換器), both of which require $A(0)=0$.(c) 由於在 $\omega=0$ 與 $\omega=\pi$ 兩處的增益都是零,它既不能當低通也不能當高通(更不能當帶阻)——通帶不可能落在頻帶端點。它的形狀適合類似帶通的行為;型式 3 的結構正是微分器與希爾伯特轉換器的天然歸宿,這兩者都要求 $A(0)=0$。(c) $\omega=0$ と $\omega=\pi$ の両方で利得が零なので、低域通過にも高域通過にも(さらに帯域阻止にも)なれない。帯域の端に通過帯域を置くことが不可能だからである。このフィルタは帯域通過に似た振る舞いに向いており、型式 3 の構造は微分器とヒルベルト変換器の本来の居場所である。どちらも $A(0)=0$ を必要とする。