Outline大綱アウトライン
7.1 Rate Conversion in Discrete Time7.1 離散時間的取樣率轉換7.1 離散時間におけるレート変換
7.2 Downsampling by M7.2 降取樣 M 倍7.2 M 倍のダウンサンプリング
7.3 Upsampling by L7.3 升取樣 L 倍7.3 L 倍のアップサンプリング
7.4 Rational Rate Change L/M7.4 有理數倍率轉換 L/M7.4 有理数倍 L/M のレート変換
7.5 MATLAB Practice7.5 MATLAB 實作7.5 MATLAB 演習
7.6 Summary7.6 總結7.6 まとめ
Exercises習題演習
DSP Study Guide · Chapter 7DSP 學習指南 · 第 7 章DSP 学習ガイド · 第 7 章

Changing the Sampling Rate改變取樣率標本化レートの変更

Downsampling, upsampling, decimation, interpolation, and rational-factor resampling — done entirely with discrete-time processing降取樣、升取樣、抽取、內插,以及有理數倍率的重新取樣——全部只用離散時間處理完成ダウンサンプリング、アップサンプリング、間引き、補間、そして有理数倍の再標本化——すべて離散時間処理だけで行う

7.1 Rate Conversion by Discrete-Time Processing7.1 用離散時間處理做取樣率轉換7.1 離散時間処理によるレート変換

Suppose a continuous-time signal $x_c(t)$ was sampled with period $T$ to give $x[n] = x_c(nT)$, but we now need the same underlying signal sampled at a different period $T_d$:假設一個連續時間訊號 $x_c(t)$ 已經以週期 $T$ 取樣,得到 $x[n] = x_c(nT)$,但我們現在需要的是同一個原始訊號以另一個週期 $T_d$ 取樣的結果:連続時間信号 $x_c(t)$ を周期 $T$ で標本化して $x[n] = x_c(nT)$ を得たとしよう。ところがいま必要なのは、同じ元の信号を別の周期 $T_d$ で標本化した結果である:

Goal of sampling-rate conversion(取樣率轉換)取樣率轉換的目標標本化レート変換の目標 $$x[n] = x_c(nT) \;\longrightarrow\; x_d[n] = x_c(nT_d)$$

This is needed constantly in practice: audio moves between 48 kHz (studio) and 44.1 kHz (CD), biomedical recorders sample at 2000 Hz but analysis may only need 250 Hz, and a modem may need fractional rate offsets corrected. The question of this chapter: can we obtain $x_d[n]$ from $x[n]$ using only discrete-time operations?這在實務上不斷出現:音訊要在 48 kHz(錄音室)與 44.1 kHz(CD)之間轉換,生醫記錄器以 2000 Hz 取樣但分析可能只需要 250 Hz,數據機則可能需要修正小數倍率的偏移。本章要問的是:能不能只用離散時間的運算,就從 $x[n]$ 得到 $x_d[n]$?これは実務で絶えず必要になる。音声は 48 kHz(スタジオ)と 44.1 kHz(CD)のあいだを行き来し、生体信号レコーダは 2000 Hz で標本化するが解析には 250 Hz しか要らないこともあり、モデムでは小数倍のレート偏差を補正しなければならない。本章の問いはこうである:離散時間の演算だけで $x[n]$ から $x_d[n]$ を得られるか。

7.1.1 The analog detour vs the DSP path7.1.1 繞道類比 vs 純數位路徑7.1.1 アナログ経由の回り道と DSP の経路

One conceptual approach is to go back to the analog world:概念上有一條路是回到類比世界:概念的には、いったんアナログの世界に戻るという道がある:

  1. Reconstruct $x_c(t)$ from $x[n]$ with a D/A converter and reconstruction filter;用 D/A 轉換器與重建濾波器,從 $x[n]$ 重建出 $x_c(t)$;D/A 変換器と再構成フィルタを使い、$x[n]$ から $x_c(t)$ を復元する;
  2. Resample $x_c(t)$ with an A/D converter at the new period $T_d$.再用 A/D 轉換器以新的週期 $T_d$ 對 $x_c(t)$ 重新取樣。新しい周期 $T_d$ のもとで、A/D 変換器により $x_c(t)$ を再標本化する。
Why the analog detour is undesirable為什麼不該繞道類比アナログ経由の回り道が望ましくない理由

The reconstruction filter, D/A and A/D converters are all non-ideal: the analog lowpass has finite roll-off and passband ripple, and each conversion adds noise and distortion. Every trip through the analog domain degrades the signal.重建濾波器、D/A 與 A/D 轉換器全都是非理想的:類比低通濾波器的滾降有限、通帶有漣波,而每一次轉換都會加進雜訊與失真。每繞一次類比域,訊號就劣化一次。所以實務上要盡量避免這條路。再構成フィルタ、D/A 変換器、A/D 変換器はいずれも非理想的である。アナログ低域通過フィルタのロールオフは有限で通過帯域にはリップルがあり、変換のたびに雑音と歪みが加わる。アナログ領域を一度通るたびに信号は劣化する。

The discrete-time alternative純離散時間的替代做法純粋に離散時間による代替手法

All rate changes can instead be built from two purely discrete-time primitives — the compressor(壓縮器 / 降取樣) $\downarrow M$ and the expander(擴張器 / 升取樣) $\uparrow L$ — combined with digital lowpass filters. The whole system then behaves like an ideal LTI resampler with no analog imperfection. This chapter develops both primitives, their spectra, and the rational-rate combination $L/M$.所有的倍率轉換,都可以改用兩個純粹的離散時間基本元件搭起來——壓縮器(compressor,降取樣) $\downarrow M$ 與擴張器(expander,升取樣) $\uparrow L$——再配合數位低通濾波器。整個系統的行為就像一個理想的 LTI 重新取樣器,完全沒有類比的不完美。本章會逐一發展這兩個元件、它們的頻譜,以及兩者合起來的有理數倍率 $L/M$。レート変換はすべて、二つの純粋に離散時間的な基本要素——圧縮器(compressor、ダウンサンプリング) $\downarrow M$ と拡張器(expander、アップサンプリング) $\uparrow L$——をディジタル低域通過フィルタと組み合わせて構成できる。そうして得られる系全体は、アナログ的な不完全さを一切もたない理想的な LTI 再標本化器として振る舞う。本章ではこの二つの基本要素、そのスペクトル、そして両者を組み合わせた有理数倍 $L/M$ を順に展開する。

7.2 Downsampling: Rate Reduction by an Integer Factor M7.2 降取樣:以整數因子 M 降低取樣率7.2 ダウンサンプリング:整数因子 M によるレート低減

7.2.1 The compressor in the time domain7.2.1 時域中的壓縮器7.2.1 時間領域における圧縮器

The sampling-rate compressor(取樣率壓縮器), written $\downarrow M$, keeps every $M$-th sample and discards the rest:取樣率壓縮器(記為 $\downarrow M$)保留每第 $M$ 個樣本,其餘全部丟棄:標本化レート圧縮器(compressor)は $\downarrow M$ と書き、$M$ 個おきの標本だけを残して残りを捨てる:

Compressor / downsampling(降取樣)壓縮器/降取樣圧縮器/ダウンサンプリング $$x_d[n] = x[nM] = x_c(nMT), \qquad M \in \mathbb{Z}^{+}$$

The output is exactly what we would have obtained by sampling $x_c(t)$ directly with the longer period $T' = MT$ — the sampling rate drops by $M$, the sample period grows by $M$. A decimator adds a protective lowpass filter in front of the compressor (next subsection):輸出結果,恰好等同於一開始就用較長的週期 $T' = MT$ 直接對 $x_c(t)$ 取樣——取樣率降為 $1/M$,取樣週期則變成 $M$ 倍。抽取器(decimator)則是在壓縮器前面再加一個保護用的低通濾波器(下一小節):この出力は、はじめから長い周期 $T' = MT$ で $x_c(t)$ を直接標本化して得られるものとちょうど一致する——標本化レートは $M$ 分の 1 になり、標本周期は $M$ 倍になる。間引き器(decimator)は、圧縮器の前に保護用の低域通過フィルタを置いたものである(次の小節):

x[n] period T anti-alias lowpass gain 1, cutoff π/M x̃[n] ↓M xd[n] = x̃[nM] period T′ = MT
Fig. 7-1 — The decimator: anti-alias lowpass filter followed by the compressor ↓M(抗混疊低通濾波器 + 壓縮器). The compressor alone is plain downsampling.圖 7-1 — 抽取器:抗混疊低通濾波器接上壓縮器 ↓M。只有壓縮器而沒有濾波器時,就是單純的降取樣。図 7-1 — 間引き器:アンチエイリアス低域通過フィルタに圧縮器 ↓M を続けたもの。フィルタのない圧縮器だけであれば、単なるダウンサンプリングである。
2026-06-12T22:24:30.636461 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 5 10 15 20 25 30 n −1 0 1 x[n] x[n] (red samples kept by the compressor, M = 3) 0 2 4 6 8 10 n −1 0 1 x_d[n] x_d[n] = x[nM] = x[3n] (new period T' = 3T)
Fig. 7-2 — Time-domain view of downsampling with $M=3$: the compressor keeps the red samples $x[0], x[3], x[6], \dots$ and re-indexes them as $x_d[n]$(保留每第 3 個樣本並重新編號).圖 7-2 — $M=3$ 時降取樣的時域圖像:壓縮器保留紅色的樣本 $x[0], x[3], x[6], \dots$,並把它們重新編號為 $x_d[n]$。図 7-2 — $M=3$ のときのダウンサンプリングを時間領域で見た図:圧縮器は赤い標本 $x[0], x[3], x[6], \dots$ だけを残し、それらを $x_d[n]$ として番号を振り直す。

7.2.2 Spectrum of the downsampled signal7.2.2 降取樣後的頻譜7.2.2 ダウンサンプリング後のスペクトル

To see what downsampling does in frequency, write $x_d[n]$ as a two-step operation: (1) multiply $x[n]$ by the periodic sampling train $c_M[n] = \frac{1}{M}\sum_{i=0}^{M-1} e^{j2\pi i n/M}$, which equals 1 when $n$ is a multiple of $M$ and 0 otherwise; (2) discard the zeros. Step (1) gives $\tilde{x}[n] = x[n]\,c_M[n]$, whose DTFT is an average of $M$ shifted copies of $X(e^{j\omega})$; step (2) rescales the frequency axis by $M$. The result:要看出降取樣在頻域做了什麼,可以把 $x_d[n]$ 拆成兩個步驟:(1) 把 $x[n]$ 乘上週期性的取樣串 $c_M[n] = \frac{1}{M}\sum_{i=0}^{M-1} e^{j2\pi i n/M}$,它在 $n$ 為 $M$ 的倍數時等於 1、其餘為 0;(2) 把那些零丟掉。步驟 (1) 得到 $\tilde{x}[n] = x[n]\,c_M[n]$,其 DTFT 是 $X(e^{j\omega})$ 的 $M$ 個平移複本的平均;步驟 (2) 則把頻率軸縮放 $M$ 倍。結果是:ダウンサンプリングが周波数領域で何をしているかを見るには、$x_d[n]$ を二段階の演算として書けばよい。(1) $x[n]$ に周期的な標本化列 $c_M[n] = \frac{1}{M}\sum_{i=0}^{M-1} e^{j2\pi i n/M}$ を掛ける。これは $n$ が $M$ の倍数のとき 1、それ以外では 0 となる。(2) その零を捨てる。段階 (1) からは $\tilde{x}[n] = x[n]\,c_M[n]$ が得られ、その DTFT は $X(e^{j\omega})$ を平行移動した $M$ 個の複製の平均である。段階 (2) は周波数軸を $M$ 倍に伸縮する。結果は次のとおり:

DTFT after downsampling(降取樣後的頻譜)降取樣後的 DTFTダウンサンプリング後の DTFT $$X_d(e^{j\omega}) \;=\; \frac{1}{M}\sum_{i=0}^{M-1} X\!\left(e^{j(\omega - 2\pi i)/M}\right)$$

Equivalently, in terms of the original continuous-time spectrum $X_c(j\Omega)$, the downsampled sequence looks exactly like sampling with period $MT$:等價地,若用原本的連續時間頻譜 $X_c(j\Omega)$ 來看,降取樣後的序列就等同於以週期 $MT$ 取樣:同じことを元の連続時間スペクトル $X_c(j\Omega)$ の言葉で言えば、ダウンサンプリングされた系列は、周期 $MT$ で標本化したものとまったく同じに見える:

In terms of $X_c$ — sampling with period $T_d = MT$以 $X_c$ 表示——等同於以週期 $T_d = MT$ 取樣$X_c$ による表現——周期 $T_d = MT$ での標本化 $$X_d(e^{j\omega}) \;=\; \frac{1}{MT}\sum_{r=-\infty}^{\infty} X_c\!\left(j\Big(\frac{\omega}{MT} - \frac{2\pi r}{MT}\Big)\right)$$
Read the formula讀懂這個公式式を読む

$X_d(e^{j\omega})$ is built from $M$ copies of $X(e^{j\omega})$, each frequency-scaled (stretched) by $M$(頻率軸被拉寬 $M$ 倍), shifted by integer multiples of $2\pi$, and scaled in amplitude by $1/M$. A band edge that sat at $\omega_N$ before downsampling moves out to $M\omega_N$ after.$X_d(e^{j\omega})$ 是由 $X(e^{j\omega})$ 的 $M$ 個複本組成的,每個複本都被在頻率軸上拉寬 $M$ 倍、平移 $2\pi$ 的整數倍,並且振幅縮小為 $1/M$。降取樣前位於 $\omega_N$ 的頻帶邊界,降取樣後會外移到 $M\omega_N$。$X_d(e^{j\omega})$ は $X(e^{j\omega})$ の $M$ 個の複製から組み立てられる。各複製は周波数軸上で $M$ 倍に引き伸ばされ(周波数軸が $M$ 倍に広がる)、$2\pi$ の整数倍だけ平行移動され、さらに振幅が $1/M$ 倍される。ダウンサンプリング前に $\omega_N$ にあった帯域端は、変換後には $M\omega_N$ まで外へ移る。

直觀解釋(點擊展開)
丟掉樣本之後,剩下的樣本「間隔變大」,等效取樣率變低。在正規化頻率 $\omega = \Omega T$ 中, 同一個實體頻率 $\Omega$ 乘上更大的 $T' = MT$,所以頻譜在 $\omega$ 軸上被「拉寬」$M$ 倍。 原本擠在 $|\omega| \le \omega_N$ 的頻譜,現在佔到 $|\omega| \le M\omega_N$。 只要拉寬後不超過 $\pi$(即 $\omega_N \le \pi/M$),各週期複本不重疊,沒有混疊; 一旦超過 $\pi$,相鄰複本互相重疊相加,混疊就發生了,而且疊上去之後再也分不開。 振幅多了 $1/M$ 是因為平均了 $M$ 個複本(能量守恆的自然結果)。

Two equivalent descriptions, and how to get from one to the other兩種等價的描述,以及如何從一種推到另一種二つの等価な記述、そして一方から他方へ移る道筋

The two boxes above are the same spectrum written from two different starting points. Knowing how they connect is what makes the $1/M$ and the "only $M$ copies" stop looking arbitrary.上面兩個方框寫的是同一個頻譜,只是出發點不同。把兩者的關係弄清楚之後,那個 $1/M$ 以及「只有 $M$ 份複本」就不再像是憑空冒出來的了。上の二つの枠は、出発点が違うだけで同じスペクトルを書いたものである。両者のつながりを押さえれば、あの $1/M$ と「複製は $M$ 個だけ」という話が、どこからともなく降ってきたものには見えなくなる。

View 1 — from $X_c(j\Omega)$View 2 — from $X(e^{j\omega})$
Starting pointthe analog spectrumthe sequence you actually hold
Number of copiesinfinitely many ($r \in \mathbb{Z}$)exactly $M$ ($i = 0,\dots,M-1$)
Copy spacingthe new sampling rate $2\pi/T_d$ on the $\Omega$ axis$2\pi$ on the output $\omega$ axis
Amplitude factor$1/T_d = 1/(MT)$$1/M$
Usable whenyou know $X_c$always
看法 1 — 從 $X_c(j\Omega)$ 出發看法 2 — 從 $X(e^{j\omega})$ 出發
起點類比頻譜你手上真正有的那個序列
複本數目無限多份($r \in \mathbb{Z}$)剛好 $M$ 份($i = 0,\dots,M-1$)
複本間隔$\Omega$ 軸上的新取樣角頻率 $2\pi/T_d$輸出 $\omega$ 軸上的 $2\pi$
振幅因子$1/T_d = 1/(MT)$$1/M$
什麼時候能用你知道 $X_c$ 的時候永遠可用
見方 1 — $X_c(j\Omega)$ から出発する見方 2 — $X(e^{j\omega})$ から出発する
出発点アナログスペクトル実際に手もとにある系列
複製の個数無限個($r \in \mathbb{Z}$)ちょうど $M$ 個($i = 0,\dots,M-1$)
複製の間隔$\Omega$ 軸上の新しい標本化角周波数 $2\pi/T_d$出力の $\omega$ 軸上で $2\pi$
振幅の因子$1/T_d = 1/(MT)$$1/M$
使える条件$X_c$ が分かっているときつねに使える

View 1 needs no new derivation: downsampling is sampling $x_c(t)$ directly with period $T_d = MT$, so substitute $T \to T_d$ in the sampling formula and read off three things — the frequency axis is scaled through $\omega = \Omega T_d$, the copies are shifted by integer multiples of $2\pi/T_d$ on the analog axis, and there is an infinite set of them. It is the more intuitive picture, but in practice you hold only $x[n]$ and may have no access to $X_c$ at all. Hence view 2.看法 1 不需要任何新的推導:降取樣就是以週期 $T_d = MT$ 直接對 $x_c(t)$ 取樣,所以只要把取樣公式裡的 $T$ 換成 $T_d$,就能讀出三件事——頻率軸透過 $\omega = \Omega T_d$ 被縮放、各複本在類比軸上平移 $2\pi/T_d$ 的整數倍、而且複本有無限多份。這個畫面比較直觀,但實務上你手上只有 $x[n]$,甚至可能根本拿不到 $X_c$。所以才需要看法 2。見方 1 には新しい導出は要らない。ダウンサンプリングとは、周期 $T_d = MT$ で $x_c(t)$ を直接標本化することそのものだから、標本化の公式で $T \to T_d$ と置き換えれば三つのことが読み取れる——周波数軸は $\omega = \Omega T_d$ を通して伸縮され、複製はアナログ軸上で $2\pi/T_d$ の整数倍だけ平行移動し、しかもその個数は無限である。こちらのほうが直観的な絵だが、実務で手もとにあるのは $x[n]$ だけで、$X_c$ にはまったく手が届かないこともある。だから見方 2 が要る。

Why infinitely many copies collapse to $M$無限多份複本為什麼會收成 $M$ 份無限個の複製がなぜ $M$ 個にまとまるのか

The whole trick is to split the summation index. Every integer $r$ decomposes uniquely as整個訣竅就在於把求和的索引拆開。任何整數 $r$ 都可以唯一地分解成要点は総和の添字を分解することに尽きる。任意の整数 $r$ は一意に次のように分解できる

Split the index modulo $M$把索引對 $M$ 拆開添字を $M$ を法として分解する $$r = i + kM, \qquad i = 0, 1, \dots, M-1, \quad k \in \mathbb{Z}$$

(For $M = 3$, $r = 7$ is $i = 1$, $k = 2$.) Substituting into view 1 with $T_d = MT$ and grouping the $k$-sum inside the $i$-sum:(當 $M = 3$ 時,$r = 7$ 就是 $i = 1$、$k = 2$。)代入看法 1 並取 $T_d = MT$,再把對 $k$ 的求和收進對 $i$ 的求和裡:($M = 3$ なら $r = 7$ は $i = 1$、$k = 2$ である。)見方 1 に $T_d = MT$ を代入し、$k$ についての和を $i$ についての和の内側にまとめると:

Regrouping the copies把複本重新分組複製をまとめ直す $$\begin{aligned} X_d(e^{j\omega}) &= \frac{1}{MT}\sum_{r=-\infty}^{\infty} X_c\!\left(j\frac{\omega}{MT} - j\frac{2\pi r}{MT}\right)\\[6pt] \text{put } r = i + kM:\quad &= \frac{1}{M}\sum_{i=0}^{M-1}\left[\frac{1}{T}\sum_{k=-\infty}^{\infty} X_c\!\left(j\frac{\omega}{MT} - j\frac{2\pi k}{T} - j\frac{2\pi i}{MT}\right)\right]\\[6pt] &= \frac{1}{M}\sum_{i=0}^{M-1}\underbrace{\left[\frac{1}{T}\sum_{k=-\infty}^{\infty} X_c\!\left(j\frac{\omega - 2\pi i}{MT} - j\frac{2\pi k}{T}\right)\right]}_{\textstyle = \ X\left(e^{j(\omega - 2\pi i)/M}\right)}\end{aligned}$$

Put $\omega' = (\omega - 2\pi i)/M$, so that $\dfrac{\omega - 2\pi i}{MT} = \dfrac{\omega'}{T}$. The bracket is then exactly the sampling formula for $X(e^{j\omega'})$ — the spectrum of the sequence before downsampling. Therefore令 $\omega' = (\omega - 2\pi i)/M$,於是 $\dfrac{\omega - 2\pi i}{MT} = \dfrac{\omega'}{T}$。中括號裡的東西就正好是 $X(e^{j\omega'})$ 的取樣公式——也就是降取樣之前那個序列的頻譜。因此$\omega' = (\omega - 2\pi i)/M$ と置くと $\dfrac{\omega - 2\pi i}{MT} = \dfrac{\omega'}{T}$ となる。すると角括弧の中身は、ちょうど $X(e^{j\omega'})$ に対する標本化の公式——すなわちダウンサンプリング前の系列のスペクトル——そのものである。したがって

View 2 recovered於是得到看法 2見方 2 が得られた $$\boxed{\ X_d(e^{j\omega}) = \frac{1}{M}\sum_{i=0}^{M-1} X\!\left(e^{j(\omega - 2\pi i)/M}\right)\ }$$
Key — what the regrouping means重點 — 這個重新分組在說什麼要点 — このまとめ直しが意味すること

Take the infinitely many $X_c$ copies and deal them into $M$ piles by $r \bmod M$. Each pile assembles into exactly one complete $X(e^{j\omega})$. Nothing was added or discarded — the infinite sum was only rebracketed, which is why both expressions must give the same answer.把無限多份 $X_c$ 複本按照 $r \bmod M$ 發成 $M$ 疊。每一疊剛好湊成一個完整的 $X(e^{j\omega})$。過程中沒有增加也沒有丟掉任何東西——那個無窮級數只是被重新加了括號,所以兩個式子必然給出同樣的結果。無限個ある $X_c$ の複製を、$r \bmod M$ にしたがって $M$ 個の山に配る。どの山もちょうど一つの完全な $X(e^{j\omega})$ を組み上げる。何も足されず、何も捨てられていない——無限和は括弧をつけ直されただけであり、だからこそ二つの式は同じ答えを与えなければならない。

The three actions in view 2看法 2 的三個動作見方 2 における三つの動作
ActionWhat it does
1. Stretch by $M$$X(e^{j\omega/M})$ widens the spectrum on the $\omega$ axis: a component that sat at $\omega_0$ moves out to $M\omega_0$.
2. ShiftThe $i$-th copy has its argument shifted by $2\pi i/M$. On the output $\omega$ axis this places one copy every $2\pi$.
3. Scale by $1/M$Each copy's height is divided by $M$ — the averaging of $M$ copies.
動作它做了什麼
1. 拉寬 $M$ 倍$X(e^{j\omega/M})$ 把頻譜在 $\omega$ 軸上拉寬:原本在 $\omega_0$ 的成分會移到 $M\omega_0$。
2. 平移第 $i$ 個複本的引數平移了 $2\pi i/M$。換到輸出的 $\omega$ 軸上看,就是每隔 $2\pi$ 放一份。
3. 高度乘 $1/M$每一份複本的高度都除以 $M$——這就是 $M$ 份複本取平均的結果。
動作その内容
1. $M$ 倍に引き伸ばす$X(e^{j\omega/M})$ はスペクトルを $\omega$ 軸上で広げる:$\omega_0$ にあった成分は $M\omega_0$ へ移る。
2. 平行移動する$i$ 番目の複製は偏角が $2\pi i/M$ だけずれる。出力の $\omega$ 軸で見れば、$2\pi$ ごとに複製が一つ置かれることになる。
3. $1/M$ 倍する各複製の高さは $M$ で割られる——$M$ 個の複製を平均することに対応する。

Actions 1 and 2 have to come as a pair, and the reason is periodicity. $X(e^{j\omega})$ is $2\pi$-periodic; stretching it by $M$ would make it $2\pi M$-periodic, which a DTFT is not allowed to be. The $M-1$ shifted copies drop into exactly those gaps and restore the period to $2\pi$. Take $M = 2$: stretching gives period $4\pi$ with a hole between $\pi$ and $3\pi$, and the single shifted copy ($i=1$) fills it.動作 1 與動作 2 必須成對出現,理由是週期性。$X(e^{j\omega})$ 的週期是 $2\pi$;把它拉寬 $M$ 倍之後週期會變成 $2\pi M$,但 DTFT 不可能是這樣。那 $M-1$ 份平移過的複本,正好落進那些空隙裡,把週期還原成 $2\pi$。以 $M = 2$ 為例:拉寬後週期變成 $4\pi$,在 $\pi$ 與 $3\pi$ 之間留下一個空洞,而唯一那份平移的複本($i=1$)剛好補上。動作 1 と動作 2 は必ず対で現れる。理由は周期性である。$X(e^{j\omega})$ は $2\pi$ 周期であり、これを $M$ 倍に引き伸ばすと $2\pi M$ 周期になってしまうが、DTFT がそうなることは許されない。$M-1$ 個の平行移動された複製がちょうどその隙間に落ち込み、周期を $2\pi$ に戻す。$M = 2$ で見てみよう:引き伸ばしによって周期は $4\pi$ となり $\pi$ と $3\pi$ のあいだに空白ができるが、ただ一つの平行移動された複製($i=1$)がそこを埋める。

This also re-derives the no-aliasing condition in one line. After stretching, the band occupies $M\omega_N$, so the copies stay clear of one another exactly when這同時也用一行就重新導出了避免混疊的條件。拉寬之後頻帶占據 $M\omega_N$,所以各複本彼此不相干擾的條件恰好是これは同時に、エイリアシングが起きない条件を一行で導き直してもいる。引き伸ばしたあと帯域は $M\omega_N$ を占めるので、複製どうしが互いに重ならないのは、ちょうど次の場合である

Stretching must not overrun $\pi$拉寬後不能超過 $\pi$引き伸ばしが $\pi$ を越えてはならない $$M\omega_N < \pi \qquad\Longleftrightarrow\qquad \omega_N < \frac{\pi}{M}$$

— the condition of §7.2.3. If it fails, lowpass-filter with cutoff $\pi/M$ first; that cascade is decimation.——正是 §7.2.3 的條件。若不滿足,就要先用截止頻率 $\pi/M$ 的低通濾波器處理;這個串接就是抽取(decimation)。——これが §7.2.3 の条件である。満たされない場合は、まず遮断周波数 $\pi/M$ の低域通過フィルタをかける。この縦続接続こそが間引き(decimation)である。

2026-06-12T22:24:30.866104 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.00 0.25 0.50 0.75 1.00 amplitude X(e^jw), wN = pi/3 0.0 0.1 0.2 0.3 0.4 amplitude X_d(e^jw), M = 3: copies just touch at w = pi (no aliasing, amplitude 1/3) −2 −1 0 1 2 w / pi 0.0 0.1 0.2 0.3 0.4 amplitude X_d(e^jw), M = 4: copies overlap -> aliasing (solid = sum)
Fig. 7-3 — Spectra in downsampling. Top: original $X(e^{j\omega})$ with band edge $\omega_N=\pi/3$. Middle: $M=3$ stretches the band edge exactly to $\pi$ — copies just touch, no aliasing(複本恰好相接,無混疊). Bottom: $M=4$ stretches past $\pi$; the dashed copies overlap and the solid sum is aliased(複本重疊 → 混疊).圖 7-3 — 降取樣的頻譜。上:原始的 $X(e^{j\omega})$,頻帶邊界在 $\omega_N=\pi/3$。中:$M=3$ 把頻帶邊界剛好拉到 $\pi$——各複本恰好相接,沒有混疊。下:$M=4$ 把它拉過了 $\pi$;虛線的複本互相重疊,實線的總和已經混疊。図 7-3 — ダウンサンプリングにおけるスペクトル。上:帯域端が $\omega_N=\pi/3$ にある元の $X(e^{j\omega})$。中:$M=3$ は帯域端をちょうど $\pi$ まで引き伸ばす——複製は接するだけで、エイリアシングは起きない。下:$M=4$ は $\pi$ を越えて引き伸ばす。破線の複製が重なり合い、実線で示した総和はエイリアシングを起こしている。

7.2.3 Aliasing and the anti-alias prefilter — the decimator7.2.3 混疊與抗混疊前置濾波器——抽取器7.2.3 エイリアシングとアンチエイリアス前置フィルタ——間引き器

From Fig. 7-3, downsampling is alias-free only when the original spectrum leaves room to be stretched:從圖 7-3 可以看出,只有當原始頻譜留有足夠空間可供拉寬時,降取樣才不會產生混疊:図 7-3 から分かるように、ダウンサンプリングがエイリアシングを免れるのは、元のスペクトルが引き伸ばされるだけの余地を残しているときだけである:

No-aliasing condition for ↓M(避免混疊條件)↓M 的避免混疊條件↓M でエイリアシングを避ける条件 $$X(e^{j\omega}) = 0 \quad \text{for } \tfrac{\pi}{M} \le |\omega| \le \pi \qquad\Longleftrightarrow\qquad \omega_N \le \frac{\pi}{M}$$

In digital frequency: the highest frequency present in $x[n]$, $\omega_N = \Omega_N T$, must satisfy $\omega_N < \dfrac{\pi}{M}$.換成數位頻率:$x[n]$ 的最高頻率 $\omega_N = \Omega_N T$ 必須滿足 $\omega_N < \dfrac{\pi}{M}$。ディジタル周波数で言えば、$x[n]$ に含まれる最高周波数 $\omega_N = \Omega_N T$ は次を満たさなければならない:$\omega_N < \dfrac{\pi}{M}$.

The boxed condition above writes $\le$ rather than $<$ because at exactly $\omega_N = \pi/M$ the stretched replicas only touch at $\pi$ and do not overlap — the middle panel of Fig. 7-3. The strict $<$ is the design-safe form: it leaves a margin instead of relying on a boundary that any filter roll-off or frequency drift would cross.上面方框內寫的是 $\le$ 而不是 $<$,是因為在 $\omega_N = \pi/M$ 恰好相等時,被拉寬的複本只是在 $\pi$ 處相接而不重疊——就是圖 7-3 中間那一張。嚴格的 $<$ 則是設計上安全的寫法:它留了餘裕,而不是把希望托在一個只要濾波器有滾降、或頻率有漂移就會跨過的邊界上。上の枠内の条件が $<$ ではなく $\le$ と書かれているのは、ちょうど $\omega_N = \pi/M$ のとき、引き伸ばされた複製は $\pi$ で接するだけで重なり合わないからである——図 7-3 の中央の図がそれにあたる。設計上安全な書き方は厳密な $<$ のほうである。フィルタのロールオフや周波数のずれがあればすぐに越えてしまう境界に頼るのではなく、余裕を残しておくという意味である。

If $x[n]$ is not bandlimited to $\pi/M$, we must lowpass-filter first. The cascade of an ideal lowpass filter (gain 1, cutoff $\pi/M$) and the compressor $\downarrow M$ is called a decimator(十中抽一器/降頻器), and the whole operation decimation(抽取). The prefilter deliberately throws away the band $|\omega| > \pi/M$ so that the surviving band comes through clean.如果 $x[n]$ 沒有帶限在 $\pi/M$ 以內,就必須先做低通濾波。把一個理想低通濾波器(增益 1、截止頻率 $\pi/M$)與壓縮器 $\downarrow M$ 串接起來,就稱為抽取器(decimator),整個運算則稱為抽取(decimation)。前置濾波器是刻意把 $|\omega| > \pi/M$ 這一段丟掉,好讓留下來的那一段能乾乾淨淨地通過。$x[n]$ が $\pi/M$ に帯域制限されていない場合には、まず低域通過フィルタをかけなければならない。理想低域通過フィルタ(利得 1、遮断周波数 $\pi/M$)と圧縮器 $\downarrow M$ を縦続接続したものを間引き器(decimator)と呼び、この演算全体を間引き(decimation)と呼ぶ。前置フィルタは $|\omega| > \pi/M$ の帯域をあえて捨て、残った帯域がきれいに通るようにする。

直觀解釋:為什麼寧可先濾掉高頻?(點擊展開)
不先濾波:高頻成分會「反摺」到低頻,跟原本的低頻成分混在一起,整個低頻帶都被汙染, 而且事後無法分離。先濾波:高頻成分被乾淨地移除,低頻帶保持正確。 兩種做法都會失去高頻資訊(這是降取樣必然的代價),但前者連低頻都毀了,後者保住低頻。 所以 decimation = 「犧牲頻寬、保全留下來的頻帶」。
Aliasing is irreversible(混疊不可逆)混疊是不可逆的エイリアシングは不可逆である

Once spectral copies overlap and add, no later processing can separate them — the folded high-frequency energy is permanently mixed into the low band. This is exactly the difference between MATLAB's downsample (no protection) and decimate (lowpass first) demonstrated below.一旦頻譜複本重疊並相加,之後任何處理都無法把它們分開——被反摺下來的高頻能量已經永久混進低頻帶裡了。所以重新取樣前務必確認高頻成分:高頻會反摺(fold)到低頻,與其他低頻成分混在一起。這正是下面要示範的 MATLAB downsample(毫無保護)與 decimate(先低通)之間的差別。スペクトルの複製がいったん重なって加算されてしまうと、その後どんな処理をしても両者を分離することはできない——折り返された高周波のエネルギーは低域に永久に混ざり込む。これはまさに、以下で示す MATLAB の downsample(保護なし)と decimate(先に低域通過)の違いそのものである。

2026-06-12T22:24:31.087038 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 25 50 75 100 125 150 175 200 0.0 0.5 1.0 |X| |X(f)| of x[n], fs = 1000 Hz (peaks at 20 Hz and 100 Hz) 0 10 20 30 40 50 60 0.0 0.5 1.0 |X| downsample(x, 8): fs' = 125 Hz -- 100 Hz aliases to 25 Hz 0 10 20 30 40 50 60 frequency (Hz) 0.0 0.5 1.0 |X| decimate(x, 8): lowpass prefilter removes 100 Hz before the compressor
Fig. 7-4 — Real demonstration: $x[n]=\sin(2\pi 20t)+\sin(2\pi 100t)$ sampled at 1000 Hz, rate reduced by $M=8$ to 125 Hz (Nyquist 62.5 Hz). Plain downsample folds the 100 Hz tone to a false 25 Hz tone; decimate removes it with the prefilter first(downsample 讓 100 Hz 假冒成 25 Hz;decimate 先低通把它濾掉).圖 7-4 — 實際示範:$x[n]=\sin(2\pi 20t)+\sin(2\pi 100t)$ 以 1000 Hz 取樣,再用 $M=8$ 把取樣率降到 125 Hz(Nyquist 頻率 62.5 Hz)。單純的 downsample 把 100 Hz 的音反摺成一個假的 25 Hz 音;decimate 則先用前置濾波器把它濾掉。図 7-4 — 実例による確認:$x[n]=\sin(2\pi 20t)+\sin(2\pi 100t)$ を 1000 Hz で標本化し、$M=8$ によってレートを 125 Hz(ナイキスト周波数 62.5 Hz)まで下げる。素の downsample は 100 Hz の音を偽の 25 Hz の音へ折り返してしまうが、decimate は前置フィルタで先にそれを取り除く。

7.3 Upsampling: Rate Increase by an Integer Factor L7.3 升取樣:以整數因子 L 提高取樣率7.3 アップサンプリング:整数因子 L によるレート増加

7.3.1 The expander7.3.1 擴張器7.3.1 拡張器

To raise the sampling rate we want $x_i[n] = x_c(nT_i)$ with $T_i = T/L$ — i.e. we must create $L-1$ new samples between every pair of existing ones. The first stage is the sampling-rate expander(取樣率擴張器) $\uparrow L$, which inserts $L-1$ zeros between samples:要提高取樣率,我們想得到 $x_i[n] = x_c(nT_i)$,其中 $T_i = T/L$——也就是必須在每一對既有樣本之間製造出 $L-1$ 個新樣本。第一級是取樣率擴張器 $\uparrow L$,它在樣本之間插入 $L-1$ 個零:標本化レートを上げるには、$T_i = T/L$ として $x_i[n] = x_c(nT_i)$ を得たい——つまり、既存の標本の各対のあいだに $L-1$ 個の新しい標本を作り出さなければならない。その第一段が標本化レート拡張器(expander) $\uparrow L$ であり、標本と標本のあいだに $L-1$ 個の零を挿入する:

Expander / zero insertion(補零擴張)擴張器/補零拡張器/零挿入 $$x_e[n] = \begin{cases} x[n/L], & n = 0, \pm L, \pm 2L, \dots \\ 0, & \text{otherwise} \end{cases} \;=\; \sum_{k=-\infty}^{\infty} x[k]\,\delta[n - kL]$$
x[n] period T ↑L xe[n] period T/L anti-imaging lowpass gain L, cutoff π/L xi[n] = xc(nT/L) period T/L
Fig. 7-5 — The interpolator: expander ↑L (zero insertion) followed by an anti-imaging lowpass filter with gain $L$ and cutoff $\pi/L$(擴張器 + 去鏡像低通濾波器).圖 7-5 — 內插器:擴張器 ↑L(補零)接上一個去鏡像低通濾波器,其增益為 $L$、截止頻率為 $\pi/L$。図 7-5 — 補間器:拡張器 ↑L(零挿入)に、利得 $L$・遮断周波数 $\pi/L$ のアンチイメージング低域通過フィルタを続けたもの。
2026-06-12T22:24:31.300709 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 1 2 3 4 5 6 −0.5 0.0 0.5 1.0 x[n] x[n] (period T) 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 −0.5 0.0 0.5 1.0 x_e[n] x_e[n]: L-1 = 2 zeros inserted between samples (period T/3) 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 n 0 1 x_i[n] x_i[n]: after ideal lowpass (gain L, cutoff pi/L) -- sinc interpolation
Fig. 7-6 — Time domain of interpolation with $L=3$: original $x[n]$ (top); $x_e[n]$ after inserting two zeros between each sample (middle); $x_i[n]$ after the ideal lowpass — the zeros are "filled in" by sinc interpolation and the original samples are preserved at $n=kL$(補零 → 低通濾波把零填成內插值,原樣本不變).圖 7-6 — $L=3$ 時內插的時域圖像:上為原始的 $x[n]$;中為每兩個樣本之間插入兩個零之後的 $x_e[n]$;下為經過理想低通之後的 $x_i[n]$——那些零被 sinc 內插「填」了起來,而原本的樣本在 $n=kL$ 處維持不變。図 7-6 — $L=3$ の補間を時間領域で見た図:上は元の $x[n]$、中は各標本のあいだに零を二つ挿入したあとの $x_e[n]$、下は理想低域通過フィルタを通したあとの $x_i[n]$——零は sinc 補間によって「埋められ」、元の標本は $n=kL$ の位置にそのまま保たれている。

7.3.2 Spectrum: compression and images7.3.2 頻譜:壓縮與映像7.3.2 スペクトル:圧縮とイメージ

The DTFT of the zero-stuffed sequence follows directly from the definition:補零後序列的 DTFT 可以直接由定義得出:零詰めされた系列の DTFT は、定義から直ちに得られる:

DTFT after expansion(擴張後的頻譜)擴張後的 DTFT拡張後の DTFT $$X_e(e^{j\omega}) \;=\; \sum_{k=-\infty}^{\infty} x[k]\,e^{-j\omega L k} \;=\; X\!\left(e^{j\omega L}\right)$$
Read the formula讀懂這個公式式を読む

The spectrum is frequency-compressed by $L$(頻譜被壓縮 $L$ 倍): the baseband copy now occupies $|\omega| \le \omega_N/L$, but the $2\pi$-periodicity of the original spectrum drags in $L-1$ extra copies — images(鏡像) — centered at $\omega = 2\pi i/L,\ i = 1,\dots,L-1$. No information is lost (zero insertion is invertible); the images are simply unwanted and must be filtered away.頻譜被在頻率軸上壓縮 $L$ 倍:基頻的那個複本現在只佔 $|\omega| \le \omega_N/L$,但原始頻譜本身的 $2\pi$ 週期性,會把另外 $L-1$ 個複本一起拉進來——這些就是映像(images),中心位於 $\omega = 2\pi i/L,\ i = 1,\dots,L-1$。過程中沒有損失任何資訊(補零是可逆的);這些映像只是我們不想要的東西,必須用濾波器去掉。スペクトルは周波数軸上で $L$ 倍に圧縮される(周波数軸は $L$ 分の 1 に縮む)。基底帯域の複製はいまや $|\omega| \le \omega_N/L$ を占めるが、元のスペクトルがもつ $2\pi$ 周期性が $L-1$ 個の余分な複製——イメージ(images)——を引き込み、その中心は $\omega = 2\pi i/L,\ i = 1,\dots,L-1$ にある。情報は何も失われない(零挿入は可逆である)。イメージは単に不要なものであり、フィルタで取り除かなければならない。

2026-06-12T22:24:31.618690 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.00 0.25 0.50 0.75 1.00 1.25 amplitude X(e^jw), wN = 0.7 pi 0.00 0.25 0.50 0.75 1.00 1.25 amplitude X_e(e^jw) = X(e^jwL), L = 2: compressed + image at w = pi (dashed: H_i, cutoff pi/2) −2 −1 0 1 2 w / pi 0.0 0.5 1.0 1.5 2.0 2.5 amplitude X_i(e^jw): image removed, gain L = 2 restores amplitude
Fig. 7-7 — Spectra in upsampling with $L=2$: original (top); after zero insertion the spectrum is compressed and an image appears at $\omega=\pi$ (middle, dashed = ideal anti-imaging filter, cutoff $\pi/2$); after filtering with gain $L=2$ the interpolated spectrum has the correct amplitude (bottom).圖 7-7 — $L=2$ 升取樣的頻譜:上為原始頻譜;補零後頻譜被壓縮,並在 $\omega=\pi$ 處出現一個映像(中,虛線為理想的去鏡像濾波器,截止頻率 $\pi/2$);以增益 $L=2$ 濾波之後,內插結果的頻譜就有了正確的振幅(下)。図 7-7 — $L=2$ のアップサンプリングにおけるスペクトル:上が元のスペクトル。零挿入後はスペクトルが圧縮され、$\omega=\pi$ にイメージが現れる(中、破線は遮断周波数 $\pi/2$ の理想アンチイメージングフィルタ)。利得 $L=2$ でフィルタリングしたあと、補間されたスペクトルは正しい振幅をもつ(下)。
Reading the four-panel figure: (a) → (d)四格圖怎麼讀:(a) → (d)四段の図の読み方:(a) → (d)

The lecture draws the same story in four stacked panels, with the image bands shaded. Panel by panel:投影片把同一件事畫成上下疊起來的四格,並把映像的頻帶塗色標出來。一格一格看:講義ではこれと同じ話を、上下に積んだ四つの図で描き、イメージの帯域に色を付けている。一段ずつ見ていこう:

  1. (a) the original $X(e^{j\omega})$ — triangles of height $1/T$ repeating with period $2\pi$ on the axis $\omega = \Omega T$.(a) 原始的 $X(e^{j\omega})$——高度為 $1/T$ 的三角形,在 $\omega = \Omega T$ 這條軸上以 $2\pi$ 為週期重複。(a) 元の $X(e^{j\omega})$——高さ $1/T$ の三角形が、軸 $\omega = \Omega T$ の上を周期 $2\pi$ で繰り返している。
  2. (b) after the expander — $X_e(e^{j\omega}) = X(e^{j\omega L})$, now on the new axis $\omega = \Omega T_i$ with $T_i = T/L$. The spectrum compresses by $L$, so for $L=2$ an extra copy lands centered at $\pm 2\pi/L = \pm\pi$. Those extra copies are the shaded bands. Note the height is still $1/T$: inserting zeros changes no sample value, so it changes no spectral amplitude.(b) 經過擴張器之後——$X_e(e^{j\omega}) = X(e^{j\omega L})$,而且軸換成了 $\omega = \Omega T_i$(其中 $T_i = T/L$)。頻譜被壓縮了 $L$ 倍,所以 $L=2$ 時會多出一份以 $\pm 2\pi/L = \pm\pi$ 為中心的複本。那些多出來的複本就是塗色的頻帶。注意高度仍然是 $1/T$:補零並沒有改動任何一個樣本值,所以也沒有改動頻譜的振幅。(b) 拡張器を通したあと——$X_e(e^{j\omega}) = X(e^{j\omega L})$ となり、軸は $T_i = T/L$ とする新しい $\omega = \Omega T_i$ に移る。スペクトルは $L$ 倍に圧縮されるので、$L=2$ では $\pm 2\pi/L = \pm\pi$ を中心とする複製が一つ余分に現れる。その余分な複製が、色を付けた帯域である。高さが依然として $1/T$ のままであることに注意したい。零を挿入しても標本値は一つも変わらないので、スペクトルの振幅も変わらないのである。
  3. (c) the filter $H_i(e^{j\omega})$ — gain $L$ on $|\omega| \le \pi/L$, zero on $\pi/L < |\omega| \le \pi$, and $2\pi$-periodic (hence the outer blocks near $\pm 2\pi$). Its zero region lines up exactly with the shaded bands — that alignment is the entire design.(c) 濾波器 $H_i(e^{j\omega})$——在 $|\omega| \le \pi/L$ 上增益為 $L$,在 $\pi/L < |\omega| \le \pi$ 上為 $0$,而且以 $2\pi$ 為週期(所以 $\pm 2\pi$ 附近還有方塊)。它為零的區間和塗色頻帶完全對齊——整個設計要的就是這個對齊。(c) フィルタ $H_i(e^{j\omega})$——$|\omega| \le \pi/L$ では利得 $L$、$\pi/L < |\omega| \le \pi$ では零であり、しかも $2\pi$ 周期である(だから $\pm 2\pi$ の付近にも同じブロックが並ぶ)。その零の領域は色付きの帯域とぴったり重なる——この一致こそが設計のすべてである。
  4. (d) the product — $X_i(e^{j\omega}) = H_i(e^{j\omega})\,X_e(e^{j\omega})$. The images are gone, and the surviving peak rises from $1/T$ to $L/T = 1/T_i$ — exactly the height a signal sampled with period $T_i$ should have.(d) 兩者相乘——$X_i(e^{j\omega}) = H_i(e^{j\omega})\,X_e(e^{j\omega})$。映像不見了,而留下來的那個峰從 $1/T$ 升到 $L/T = 1/T_i$——這正是一個以週期 $T_i$ 取樣的訊號該有的高度。(d) 両者の積——$X_i(e^{j\omega}) = H_i(e^{j\omega})\,X_e(e^{j\omega})$。イメージは消え、生き残ったピークは $1/T$ から $L/T = 1/T_i$ へと上がる——周期 $T_i$ で標本化された信号がもつべき高さ、ちょうどその値である。
直觀解釋:imaging 跟 aliasing 哪裡不同?為什麼增益要 L?(點擊展開)直觀解釋:imaging 跟 aliasing 哪裡不同?為什麼增益要 L?(點擊展開)直観的な説明:imaging と aliasing はどこが違うのか。なぜ利得は L なのか。(クリックで展開)
Aliasing(混疊)是複本「疊在一起、加起來」,資訊被破壞,不可逆。 Imaging(鏡像)是複本「彼此分開地」出現在新的頻帶裡,資訊沒被破壞, 只要低通濾波就能乾淨移除,完全可逆。 增益要 $L$ 的原因:補零後每 $L$ 個樣本只有 1 個非零,序列的「平均能量」掉了 $L$ 倍; 等效地說,內插輸出對應 $1/T_i = L/T$ 的取樣率,頻譜高度應為 $\frac{1}{T_i}X_c = \frac{L}{T}X_c$, 所以濾波器要把高度乘回 $L$ 才能讓 $x_i[n] = x_c(nT/L)$ 的振幅正確。

7.3.3 Ideal bandlimited interpolation7.3.3 理想帶限內插7.3.3 理想帯域制限補間

The ideal anti-imaging filter has gain $L$ and cutoff $\pi/L$:理想的去鏡像濾波器增益為 $L$、截止頻率為 $\pi/L$:理想のアンチイメージングフィルタは、利得 $L$、遮断周波数 $\pi/L$ をもつ:

Ideal interpolation filter(理想內插濾波器)理想內插濾波器理想補間フィルタ $$H_i(e^{j\omega}) = \begin{cases} L, & |\omega| < \pi/L \\ 0, & \pi/L \le |\omega| \le \pi \end{cases} \qquad\Longleftrightarrow\qquad h_i[n] = \frac{\sin(\pi n / L)}{\pi n / L}$$
Why $H_i$ is called a lowpass filter為什麼 $H_i$ 叫做「低通濾波器」なぜ $H_i$ を低域通過フィルタと呼ぶのか

$H_i(e^{j\omega})$ is an ideal lowpass filter(理想低通濾波器), and the name is a literal description of the two cases above: the passband(通帶) $|\omega| < \pi/L$ sits around $\omega = 0$ and is kept (scaled by $L$), while the stopband(止帶) $\pi/L \le |\omega| \le \pi$ is zeroed. It passes the low frequencies and blocks everything above the cutoff $\omega_c = \pi/L$.$H_i(e^{j\omega})$ 是一個理想低通濾波器,而這個名字就是上面那兩個 case 的字面描述:通帶 $|\omega| < \pi/L$ 落在 $\omega = 0$ 附近,會被保留下來(並乘上增益 $L$);止帶 $\pi/L \le |\omega| \le \pi$ 則被歸零。也就是「讓低頻通過、把截止頻率 $\omega_c = \pi/L$ 以上全部擋掉」。$H_i(e^{j\omega})$ は理想低域通過フィルタであり、その名前は上の二つの場合分けをそのまま言い表したものである。通過帯域 $|\omega| < \pi/L$ は $\omega = 0$ のまわりにあって保たれ($L$ 倍される)、阻止帯域 $\pi/L \le |\omega| \le \pi$ は零にされる。低い周波数を通し、遮断周波数 $\omega_c = \pi/L$ より上をすべて阻止するわけである。

Upsampling needs exactly that shape. Zero insertion gives $X_e(e^{j\omega}) = X(e^{j\omega L})$ — the original spectrum compressed by $L$ — which leaves the baseband copy inside $|\omega| \le \pi/L$ and the $L-1$ unwanted images(映像) outside it (Fig. 7-7). The images are the high-frequency content, so a lowpass with cutoff $\pi/L$ keeps the baseband copy and deletes every image at once. That is what turns the jagged zero-stuffed sequence into a smooth interpolated one; the gain $L$ then restores the amplitude.升取樣需要的正是這個形狀。補零之後 $X_e(e^{j\omega}) = X(e^{j\omega L})$——原頻譜被壓縮了 $L$ 倍——基頻那一份落在 $|\omega| \le \pi/L$ 之內,而 $L-1$ 個不要的映像落在它外面(見圖 7-7)。這些映像就是高頻成分,所以一個截止頻率為 $\pi/L$ 的低通濾波器,一次就能留下基頻、刪掉所有映像。這就是把補零後鋸齒狀的序列變成平滑內插訊號的原因;而增益 $L$ 再把振幅補回正確值。アップサンプリングが必要とするのは、まさにこの形である。零挿入によって $X_e(e^{j\omega}) = X(e^{j\omega L})$——元のスペクトルを $L$ 倍に圧縮したもの——が得られ、基底帯域の複製は $|\omega| \le \pi/L$ の内側に、不要な $L-1$ 個のイメージはその外側に残る(図 7-7)。イメージこそが高周波成分なので、遮断周波数 $\pi/L$ の低域通過フィルタは基底帯域の複製を残したまま、すべてのイメージを一度に消し去る。これが、ぎざぎざの零詰め系列を滑らかな補間信号へ変えるものである。そのあと利得 $L$ が振幅を元に戻す。

Why "ideal" — and what you actually build為什麼叫「理想」——以及實際上你做得出什麼なぜ「理想」なのか——そして実際に作れるもの

The response above is a perfect brick wall(磚牆): zero transition width and infinite stopband attenuation. That is why its impulse response is the sinc on the right of the equation, and a sinc is infinitely long and non-causal ($h_i[n] \ne 0$ for $n < 0$) — so the ideal filter can never be implemented exactly. A real interpolator uses a finite FIR approximation instead: a windowed sinc (fir1), an equiripple Parks–McClellan design (firpm), or a ready-made interp / upfirdn. The approximation trades the brick wall for a narrow but nonzero transition band and a finite stopband attenuation, so a little image energy always leaks through. §7.3.4 takes this to the crude extreme with the zero-order hold and the linear interpolator.上面那個響應是一面完美的磚牆(brick wall):過渡帶寬度為零、止帶衰減無限大。正因如此,它的脈衝響應才會是等式右邊那個 sinc,而 sinc 是無限長且非因果的($n < 0$ 時 $h_i[n] \ne 0$)——所以理想濾波器永遠無法被精確實現。實際的內插器改用有限長的 FIR 近似:加窗的 sinc(fir1)、等漣波的 Parks–McClellan 設計(firpm),或是現成的 interp/upfirdn。這些近似把磚牆換成一段很窄但不為零的過渡帶與有限的止帶衰減,因此總會有一點映像能量漏過去。§7.3.4 會把這件事推到最粗糙的極端:零階保持與線性內插。上の応答は完全なブリックウォール(brick wall)である。遷移帯域の幅は零、阻止帯域の減衰は無限大。だからこそそのインパルス応答は式の右辺の sinc になるのだが、sinc は無限に長く、しかも非因果的($n < 0$ でも $h_i[n] \ne 0$)である——したがって理想フィルタを厳密に実現することはできない。実際の補間器は、そのかわりに有限長の FIR 近似を用いる。窓をかけた sinc(fir1)、等リップルの Parks–McClellan 設計(firpm)、あるいは出来合いの interp/upfirdn である。この近似はブリックウォールを、狭いが零ではない遷移帯域と有限の阻止帯域減衰に置き換えるので、わずかなイメージのエネルギーはつねに漏れ出る。§7.3.4 では、零次ホールドと線形補間器によってこれを最も粗い極端まで押し進める。

Panel (d) is a product in frequency, and multiplication in frequency is convolution in time — so the same step written in the time domain is $x_i[n] = x_e[n] * h_i[n]$, with the kernel being the impulse response of the filter in panel (c). That convolution is the discrete-time version of Shannon sinc interpolation (the formula on slide 17):(d) 格在頻域是一個乘法,而頻域相乘就是時域摺積——所以同一個步驟寫在時域就是 $x_i[n] = x_e[n] * h_i[n]$,其中的核正是 (c) 格那個濾波器的脈衝響應。這個摺積就是 Shannon sinc 內插的離散時間版本(投影片第 17 頁的公式):(d) の段は周波数領域での積であり、周波数領域での掛け算は時間領域での畳み込みである——だから同じ段階を時間領域で書けば $x_i[n] = x_e[n] * h_i[n]$ となり、その核はまさに (c) の段のフィルタのインパルス応答である。この畳み込みこそが、シャノンの sinc 補間の離散時間版(スライド 17 の式)である:

Sinc interpolation — two equivalent formssinc 內插——兩個等價的寫法sinc 補間——二つの等価な表現 $$\begin{aligned} x_i[n] &= \sum_{k=-\infty}^{\infty} x_e[k]\;\frac{\sin\frac{\pi}{L}(n-k)}{\frac{\pi}{L}(n-k)} \\[6pt] &= \sum_{k=-\infty}^{\infty} x[k]\;\frac{\sin\frac{\pi}{L}(n-kL)}{\frac{\pi}{L}(n-kL)} \end{aligned}$$

The two lines say the same thing. The first is the convolution sum verbatim, running over every index of the zero-stuffed sequence. But $x_e[k]$ is nonzero only at multiples of $L$, where $x_e[mL] = x[m]$, so all but every $L$-th term vanishes: substituting $k = mL$ and renaming $m \to k$ gives the second line. The first form is written in terms of the sequence that actually enters the filter, the second in terms of the original samples you started from — and both are "delete the shaded image bands", seen in the time domain.這兩行說的是同一件事。第一行就是摺積和的原樣,對補零序列的每一個索引求和。但 $x_e[k]$ 只有在 $L$ 的倍數上才不為零,且 $x_e[mL] = x[m]$,所以除了每第 $L$ 項以外全部消失:代入 $k = mL$ 再把 $m$ 改名為 $k$,就得到第二行。第一種寫法是用「真正進到濾波器裡的那個序列」來表示,第二種則是用「你一開始手上的原樣本」來表示——而兩者都是同一件事:在時域看到的「把塗色的映像頻帶刪掉」。この二行は同じことを言っている。第一行は畳み込み和をそのまま書いたもので、零詰め系列のすべての添字にわたって和をとる。しかし $x_e[k]$ が零でないのは $L$ の倍数のところだけで、そこでは $x_e[mL] = x[m]$ であるから、$L$ 個おきの項を除いてすべて消える。$k = mL$ を代入し $m \to k$ と名前を付け替えれば、第二行が得られる。第一の表現は実際にフィルタへ入る系列の言葉で書かれ、第二の表現は出発点となった元の標本の言葉で書かれている——そしてどちらも、時間領域から見た「色付きのイメージ帯域を消す」という同じ操作である。

Two properties follow immediately, because $h_i[0]=1$ and $h_i[kL]=0$ for $k \ne 0$:由於 $h_i[0]=1$ 且當 $k \ne 0$ 時 $h_i[kL]=0$,立刻可以得到兩個性質:$h_i[0]=1$ であり、$k \ne 0$ のとき $h_i[kL]=0$ であることから、二つの性質が直ちに従う:

How the interpolation actually happens內插到底是怎麼發生的補間は実際にどのように起きているのか

It is worth reading the second form of the sum once more, because it says something very concrete. Write it as a superposition:值得再讀一次那個和式的第二種寫法,因為它說的事情非常具體。把它寫成疊加的形式:この和の第二の表現をもう一度読む価値がある。きわめて具体的なことを言っているからである。重ね合わせの形に書いてみよう:

Interpolation as superposition of shifted sincs內插=平移 sinc 的疊加補間=平行移動した sinc の重ね合わせ $$x_i[n] \;=\; \sum_{k=-\infty}^{\infty} x[k]\, h_i[n-kL]$$

Each original sample $x[k]$ plants one sinc pulse, centered at its own new position $kL$ and scaled by its own value. The output at any index $n$ is the sum of all those overlapping pulses read at $n$. The expander does not create any values — it only makes room, moving $x[k]$ to position $kL$ and leaving $L-1$ empty slots between neighbors. The filter is what fills those slots.每一個原始樣本 $x[k]$ 都種下一個 sinc 脈衝,中心落在它自己的新位置 $kL$,高度按它自己的值縮放。任何索引 $n$ 上的輸出,就是所有這些互相重疊的脈衝在 $n$ 處的總和。擴張器並沒有造出任何值——它只是挪出空間,把 $x[k]$ 搬到位置 $kL$,並在相鄰兩者之間留下 $L-1$ 個空格。真正把空格填起來的是濾波器。元の標本 $x[k]$ はそれぞれ、自分の新しい位置 $kL$ を中心とし、自分の値で振幅を決めた sinc パルスを一つ植える。任意の添字 $n$ における出力は、それら重なり合うパルスをすべて $n$ で読んだ値の総和である。拡張器は値を何も作り出さない——ただ場所を空け、$x[k]$ を位置 $kL$ へ移し、隣り合う標本のあいだに $L-1$ 個の空きを残すだけである。その空きを埋めるのがフィルタである。

Why the original samples survive is now visible in one line: $h_i[0]=1$ while $h_i[\pm L] = h_i[\pm 2L] = \dots = 0$. At $n = kL$ exactly one pulse — the one belonging to $x[k]$ — is at its peak, and every other pulse is crossing zero. Hence $x_i[kL] = x[k]$.原始樣本為什麼能原封不動保留下來,現在一行就看得出來:$h_i[0]=1$,而 $h_i[\pm L] = h_i[\pm 2L] = \dots = 0$。在 $n = kL$ 上恰好只有一個脈衝——屬於 $x[k]$ 的那一個——正處於峰值,其他每個脈衝都剛好過零。因此 $x_i[kL] = x[k]$。元の標本がなぜそのまま残るのかは、いまや一行で見える。$h_i[0]=1$ である一方、$h_i[\pm L] = h_i[\pm 2L] = \dots = 0$ である。$n = kL$ ではちょうど一つのパルス——$x[k]$ に属するもの——がピークにあり、他のパルスはすべて零を横切っている。ゆえに $x_i[kL] = x[k]$ となる。

At an in-between index the neighboring sincs are not zero, so the output is a weighted mix of nearby original samples. For $L=3$ and $n=1$, evaluating $h_i$ at the distances $1, 2, 4, 5$ gives但在兩者之間的索引上,鄰近的 sinc 不為零,所以輸出是附近若干原始樣本的加權混合。以 $L=3$、$n=1$ 為例,把 $h_i$ 在距離 $1, 2, 4, 5$ 上求值,得到あいだの添字では隣接する sinc は零でないので、出力は近傍の元の標本の重み付き混合になる。$L=3$、$n=1$ の場合、距離 $1, 2, 4, 5$ で $h_i$ を評価すると

A filled-in point, $L=3$, $n=1$被填進去的一點:$L=3$、$n=1$埋められた一点、$L=3$、$n=1$ $$x_i[1] \;\approx\; 0.83\,x[0] \;+\; 0.41\,x[1] \;-\; 0.21\,x[-1] \;-\; 0.17\,x[2] \;+\; \cdots$$

The nearest sample carries the largest weight; samples farther away contribute smaller corrections, sometimes negative. Those alternating-sign tails are exactly what makes the result land on the smooth bandlimited(帶限) curve through the original samples, rather than on the straight chords a linear interpolator would draw.最近的樣本權重最大;比較遠的樣本給出較小的修正,而且有時是負的。正是這些正負交替的尾巴,讓結果落在通過原始樣本的那條平滑帶限曲線上,而不是落在線性內插會畫出的直線弦上。最も近い標本が最大の重みをもち、遠い標本は小さな補正を、ときに負の値で与える。この符号が交互に入れ替わる裾こそが、結果を、元の標本を通る滑らかな帯域制限された曲線の上に乗せるものであって、線形補間器が描くような直線の弦の上には乗せないのである。

1
Interactive — sinc interpolation with $L=3$. Drag the slider to pick an output index $n$ and watch which pulses contribute to it. At $n=0,3,6$ only one pulse is nonzero, so the original sample passes through; at $n=1,2,4,5$ several pulses overlap and the red output point is their weighted sum, landing on the dashed bandlimited curve.互動圖 — $L=3$ 的 sinc 內插。拖動滑桿選擇一個輸出索引 $n$,看看有哪些脈衝對它有貢獻。在 $n=0,3,6$ 處只有一個脈衝不為零,所以原始樣本原樣通過;在 $n=1,2,4,5$ 處則有好幾個脈衝重疊,紅色的輸出點就是它們的加權和,落在虛線的帶限曲線上。インタラクティブ図 — $L=3$ の sinc 補間。スライダをドラッグして出力の添字 $n$ を選び、どのパルスがそこに寄与しているかを見てほしい。$n=0,3,6$ では零でないパルスが一つしかないので、元の標本がそのまま通る。$n=1,2,4,5$ では複数のパルスが重なり、赤い出力点はそれらの重み付き和となって、破線の帯域制限曲線の上に乗る。

The same operation, seen from the two domains:同一個運算,從兩個域分別來看:同じ演算を、二つの領域から見てみよう:

DomainWhat happens
TimeEach original sample emits a sinc centered at $kL$; the overlapping sincs add up and fill the inserted zeros smoothly, while leaving the originals untouched at $n=kL$.
FrequencyThe lowpass removes the images (the shaded bands of Fig. 7-7), leaving only the baseband spectrum.
域發生了什麼
時域每個原始樣本送出一個以 $kL$ 為中心的 sinc;這些重疊的 sinc 相加之後,平滑地把補進去的零填滿,同時在 $n=kL$ 處不動到原樣本。
頻域低通濾波器移除映像(圖 7-7 裡塗色的頻帶),只留下基頻的頻譜。
領域そこで起きること
時間領域元の標本はそれぞれ $kL$ を中心とする sinc を放ち、重なり合った sinc が加算されて、挿入された零を滑らかに埋める。その一方で $n=kL$ にある元の標本には手を触れない。
周波数領域低域通過フィルタがイメージ(図 7-7 の色付きの帯域)を取り除き、基底帯域のスペクトルだけを残す。

The two are the same statement: smooth in time means no high-frequency images in frequency. That is why a lowpass filter — and nothing more — is the interpolator. The gain $L$ is the bookkeeping that restores the amplitude lost when the same energy was spread over $L$ times as many samples.這兩句話其實是同一句:時域上平滑,就等於頻域上沒有高頻映像。這就是為什麼一個低通濾波器——不多不少——就是內插器。而增益 $L$ 只是把帳算回來:同樣的能量被攤到 $L$ 倍多的樣本上,振幅掉了 $L$ 倍,乘回去就對了。この二つは同じ主張である。時間領域で滑らかだということは、周波数領域に高周波のイメージがないということに等しい。だからこそ低域通過フィルタが——それ以上のものは要らず——補間器そのものである。利得 $L$ は帳尻合わせであり、同じエネルギーが $L$ 倍の個数の標本に広げられたときに失われた振幅を戻している。

7.3.4 Practical interpolators: zero-order hold and linear7.3.4 實用的內插器:零階保持與線性內插7.3.4 実用的な補間器:零次ホールドと線形補間

The ideal sinc filter is infinitely long and non-causal, so practical systems use short approximations. The two classics:理想的 sinc 濾波器是無限長且非因果的,所以實際系統只能用簡短的近似。兩個經典做法:理想の sinc フィルタは無限に長く非因果的なので、実際の系では短い近似を使う。古典的なのは次の二つである:

Zero-order hold(零階保持)and linear interpolator(線性內插)零階保持(ZOH)與線性內插器零次ホールド(ZOH)と線形補間器 $$h_{\mathrm{zoh}}[n] = \begin{cases} 1, & 0 \le n \le L-1 \\ 0, & \text{else} \end{cases} \qquad h_{\mathrm{lin}}[n] = \begin{cases} 1 - |n|/L, & |n| \le L \\ 0, & \text{else} \end{cases}$$

The ZOH simply repeats each sample $L$ times (a staircase); the linear interpolator draws straight lines between samples (note $h_{\mathrm{lin}} = \tfrac{1}{L}\, h_{\mathrm{zoh}} * h_{\mathrm{zoh}}$, a triangle). Their frequency responses,ZOH 只是把每個樣本重複 $L$ 次(階梯狀);線性內插器則在樣本之間拉直線(注意 $h_{\mathrm{lin}} = \tfrac{1}{L}\, h_{\mathrm{zoh}} * h_{\mathrm{zoh}}$,是一個三角形)。它們的頻率響應,ZOH は各標本を単に $L$ 回繰り返すだけである(階段状になる)。線形補間器は標本と標本のあいだに直線を引く($h_{\mathrm{lin}} = \tfrac{1}{L}\, h_{\mathrm{zoh}} * h_{\mathrm{zoh}}$、すなわち三角形であることに注意)。それらの周波数応答は、

Frequency responses of practical interpolators實用內插器的頻率響應実用的な補間器の周波数応答 $$\big|H_{\mathrm{zoh}}(e^{j\omega})\big| = \left|\frac{\sin(\omega L/2)}{\sin(\omega/2)}\right|, \qquad H_{\mathrm{lin}}(e^{j\omega}) = \frac{1}{L}\left[\frac{\sin(\omega L/2)}{\sin(\omega/2)}\right]^{2}$$

only approximate the ideal brick wall: the passband droops slightly and the images around $2\pi i/L$ are attenuated but not eliminated (the linear interpolator at least places spectral zeros exactly at the image centers $\omega = 2\pi i /L$). They work well when the signal is heavily oversampled, i.e. its energy is concentrated at $|\omega| \ll \pi$.只能近似理想的直角截止:通帶會略微下垂,而 $2\pi i/L$ 附近的映像只被衰減、並未消除(線性內插器至少把頻譜的零點剛好放在映像中心 $\omega = 2\pi i /L$ 上)。當訊號被大幅過取樣,也就是能量集中在 $|\omega| \ll \pi$ 時,它們的效果就很好。理想のブリックウォールを近似するにとどまる。通過帯域はわずかに垂れ下がり、$2\pi i/L$ のまわりのイメージは減衰こそするが消えはしない(線形補間器は少なくとも、スペクトルの零点をイメージの中心 $\omega = 2\pi i /L$ にちょうど置いてくれる)。信号が大きく過標本化されているとき、すなわちエネルギーが $|\omega| \ll \pi$ に集中しているときには、これらはよく働く。

2026-06-12T22:24:31.903379 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 5 10 15 20 25 30 35 n (high-rate index) −1.0 −0.5 0.0 0.5 1.0 Interpolating by L = 5: ZOH vs linear vs ideal bandlimited ideal (sinc) zero-order hold linear original samples 0.0 0.2 0.4 0.6 0.8 1.0 w / pi 0 1 2 3 4 5 |H(e^jw)| Frequency responses, L = 5: imperfect image suppression above pi/L ideal LPF (gain L, cutoff pi/L) linear h_lin[n] ZOH h_zoh[n]
Fig. 7-8 — Practical interpolators for $L=5$. Top: ZOH staircase vs linear vs ideal sinc interpolation through the same samples. Bottom: their magnitude responses — both leak energy above $\pi/5$ where the ideal filter would remove all images(ZOH/線性內插只能部分抑制鏡像).圖 7-8 — $L=5$ 時的實用內插器。上:通過同一組樣本的 ZOH 階梯、線性內插與理想 sinc 內插之比較。下:它們的振幅響應——兩者在 $\pi/5$ 以上都有能量洩漏,而理想濾波器在那裡會把所有映像清乾淨。図 7-8 — $L=5$ の場合の実用的な補間器。上:同じ標本群を通る ZOH の階段、線形補間、理想 sinc 補間の比較。下:それらの振幅応答——理想フィルタならすべてのイメージを消し去るはずの $\pi/5$ より上で、どちらもエネルギーを漏らしている。

7.4 General Rate Change by a Rational Factor L/M7.4 以有理數因子 L/M 做一般性的倍率轉換7.4 有理数因子 L/M による一般のレート変換

7.4.1 Cascade and combined filter7.4.1 串接與合併濾波器7.4.1 縦続接続と合成フィルタ

A noninteger rate change is achieved by interpolating by $L$ first, then decimating by $M$, giving a new sampling period非整數的倍率轉換,做法是先內插 $L$ 倍、再抽取 $M$ 倍,得到新的取樣週期非整数のレート変換は、まず $L$ 倍に補間し、続いて $M$ 倍に間引くことで実現され、新しい標本化周期は次のようになる

Rational rate change(有理數倍率轉換)有理數倍率轉換有理数倍のレート変換 $$T' = \frac{M}{L}\,T \qquad\text{i.e.}\qquad f_s' = \frac{L}{M}\, f_s$$

In the cascade, the interpolation filter (gain $L$, cutoff $\pi/L$) and the decimation filter (gain 1, cutoff $\pi/M$) operate back-to-back at the same (high) rate, so they collapse into one lowpass filter taking the tighter of the two cutoffs:在這個串接中,內插濾波器(增益 $L$、截止 $\pi/L$)與抽取濾波器(增益 1、截止 $\pi/M$)背靠背地跑在同一個(高)取樣率上,所以兩者可以合併成一個低通濾波器,截止頻率取兩者中較嚴格的那一個:この縦続接続では、補間フィルタ(利得 $L$、遮断 $\pi/L$)と間引きフィルタ(利得 1、遮断 $\pi/M$)が同じ(高い)レートで背中合わせに動くので、両者は遮断周波数の厳しいほうをとった一つの低域通過フィルタにまとまる:

Combined filter(合併濾波器)合併後的濾波器合成フィルタ $$H(e^{j\omega}) = \begin{cases} L, & |\omega| < \min\!\left(\dfrac{\pi}{L}, \dfrac{\pi}{M}\right) \\ 0, & \text{otherwise} \end{cases}$$
(a) interpolator followed by decimator x[n] ↑L interp. lowpass gain L, π/L decim. lowpass gain 1, π/M ↓M y[n] (b) the two filters merge into one lowpass at the high rate x[n] T ↑L T/L combined lowpass gain L, cutoff min(π/L, π/M) T/L ↓M y[n] TM/L
Fig. 7-9 — Changing the sampling rate by the noninteger factor $L/M$: (a) interpolator followed by decimator; (b) simplified system with the interpolation and decimation filters combined into one(內插與抽取濾波器合併為一個低通).圖 7-9 — 以非整數因子 $L/M$ 改變取樣率:(a) 內插器接抽取器;(b) 把內插與抽取濾波器合併成單一低通之後的簡化系統。図 7-9 — 非整数因子 $L/M$ による標本化レートの変更:(a) 補間器に間引き器を続けたもの、(b) 補間フィルタと間引きフィルタを一つにまとめた簡略化された系。
直觀解釋:為什麼一定要「先升後降」?(點擊展開)
$\uparrow L$ 完全不丟資訊,$\downarrow M$ 一定丟資訊(頻寬被砍到 $\pi/M$)。 若先 $\downarrow M$ 再 $\uparrow L$,會先把頻寬砍到 $\pi/M$,砍掉的東西再也回不來; 先 $\uparrow L$ 再 $\downarrow M$ 則只在「最後不得不」的時候才砍,保留的頻寬是 $\min(\pi/L, \pi/M)$ 換算回原始頻率軸後可能完整保留整個訊號 (例如 $L/M = 3/2$:先升 3 倍後,$\pi/2$ 的削減在原訊號座標是 $3\pi/2 > \pi$,毫無損失)。 另外 $L$ 與 $M$ 應互質(取 $\gcd$ 約分),否則白做工。
Polyphase implementation(多相實現)多相實現(polyphase)多相実現(polyphase)

Filtering at the high rate $LT$ seems wasteful: most input samples of the filter are the inserted zeros, and most output samples are immediately discarded by $\downarrow M$. A polyphase implementation reorganizes the FIR filter into $L$ short subfilters so that only the samples actually kept are ever computed. MATLAB's resample uses exactly this ("using a polyphase implementation", per its help text) — that is why it is fast.在高取樣率 $LT$ 上做濾波看起來很浪費:濾波器的輸入樣本大多是補進去的零,而輸出樣本又大多立刻被 $\downarrow M$ 丟掉。多相(polyphase)實現把 FIR 濾波器重新組織成 $L$ 個短的子濾波器,使得只有真正會被保留的樣本才會被計算。MATLAB 的 resample 用的正是這個方法(其說明文字寫著「using a polyphase implementation」)——這就是它為什麼快。高いレート $LT$ でフィルタリングするのは無駄に見える。フィルタの入力標本の大半は挿入された零であり、出力標本の大半は直後に $\downarrow M$ によって捨てられるからである。多相(polyphase)実現は、FIR フィルタを $L$ 個の短い部分フィルタに組み替え、実際に残される標本だけが計算されるようにする。MATLAB の resample はまさにこれを用いており(ヘルプにも「using a polyphase implementation」とある)、それが速さの理由である。

7.4.2 Worked example: 3/2 rate change7.4.2 範例:3/2 倍率轉換7.4.2 例題:3/2 倍のレート変換

Example 7.1 — From 2000 Hz to 3000 Hz ($L=3$, $M=2$)範例 7.1 — 從 2000 Hz 到 3000 Hz($L=3$、$M=2$)例題 7.1 — 2000 Hz から 3000 Hz へ($L=3$、$M=2$)
Step 1 — factor the ratio. $f_s'/f_s = 3000/2000 = 3/2$, so $L=3$, $M=2$ (already coprime).第 1 步 — 把比值化成分數。$f_s'/f_s = 3000/2000 = 3/2$,所以 $L=3$、$M=2$(已經互質)。第 1 段 — 比を分数にする。$f_s'/f_s = 3000/2000 = 3/2$ なので $L=3$、$M=2$(すでに互いに素である)。
Step 2 — expand. $\uparrow 3$ raises the rate to 6000 Hz; the spectrum compresses by 3 and two images appear.第 2 步 — 擴張。$\uparrow 3$ 把取樣率提高到 6000 Hz;頻譜被壓縮 3 倍,並出現兩個映像。第 2 段 — 拡張する。$\uparrow 3$ によってレートは 6000 Hz に上がる。スペクトルは 3 倍に圧縮され、イメージが二つ現れる。
Step 3 — one lowpass. Combined filter: gain $3$, cutoff $\min(\pi/3, \pi/2) = \pi/3$. It removes the images (interpolation role); since $\pi/3 \le \pi/2$, it simultaneously guarantees the later $\downarrow 2$ cannot alias (decimation role).第 3 步 — 單一低通。合併後的濾波器:增益 $3$、截止頻率 $\min(\pi/3, \pi/2) = \pi/3$。它負責去掉映像(內插的角色);而因為 $\pi/3 \le \pi/2$,它同時也保證了後面的 $\downarrow 2$ 不會產生混疊(抽取的角色)。第 3 段 — 低域通過フィルタ一つ。合成フィルタは利得 $3$、遮断周波数 $\min(\pi/3, \pi/2) = \pi/3$。これがイメージを取り除き(補間としての役割)、$\pi/3 \le \pi/2$ であるから、同時に後段の $\downarrow 2$ がエイリアシングを起こしえないことも保証する(間引きとしての役割)。
Step 4 — compress. $\downarrow 2$ brings 6000 Hz down to 3000 Hz. Output: $y[n] = x_c(n \cdot \tfrac{2}{3}T)$, assuming $x_c$ was sampled above its Nyquist rate originally.第 4 步 — 壓縮。$\downarrow 2$ 把 6000 Hz 降回 3000 Hz。輸出為 $y[n] = x_c(n \cdot \tfrac{2}{3}T)$,前提是 $x_c$ 原本的取樣率高於其 Nyquist 速率。第 4 段 — 圧縮する。$\downarrow 2$ が 6000 Hz を 3000 Hz へ戻す。出力は $y[n] = x_c(n \cdot \tfrac{2}{3}T)$ である。ただし $x_c$ がもともとそのナイキストレートより高いレートで標本化されていたとする。
MATLAB: y = resample(x, 3, 2); — and remember to rebuild the time axis: ty = (0:length(y)-1)/3000;MATLAB:y = resample(x, 3, 2);——並且別忘了重建時間軸:ty = (0:length(y)-1)/3000;MATLAB:y = resample(x, 3, 2);——そして時間軸を作り直すのを忘れないこと:ty = (0:length(y)-1)/3000;

7.5 MATLAB Practice: decimate, downsample, resample, rat7.5 MATLAB 實作:decimate、downsample、resample、rat7.5 MATLAB 演習:decimate、downsample、resample、rat

7.5.1 decimate vs downsample(有無抗混疊濾波的差別)7.5.1 decimate vs downsample(有無抗混疊濾波的差別)7.5.1 decimate と downsample(アンチエイリアスフィルタの有無による違い)

The lecture's running example: a signal sampled at 1000 Hz must be reduced to $1000/8 = 125$ Hz. Two one-line options exist, and they are not equivalent:課堂上一路使用的例子:一個以 1000 Hz 取樣的訊號,必須降到 $1000/8 = 125$ Hz。有兩種一行就能寫完的做法,而它們並不等價:講義を通して使われている例。1000 Hz で標本化された信号を $1000/8 = 125$ Hz まで落とさなければならない。一行で書ける方法が二つあるが、両者は等価ではない:

CallWhat it doesAliasing protection
down_signal = downsample(signal, 8);keeps every 8th sample (pure compressor $\downarrow 8$)None — high frequencies fold into the low band
deci_signal = decimate(signal, 8);lowpass-filters (8th-order Chebyshev Type I, cutoff $0.8\,(f_s/2)/8$, applied forward-backward), then keeps every 8th sampleYes — band above the new Nyquist is removed first
呼叫方式它做了什麼有無抗混疊保護
down_signal = downsample(signal, 8);保留每第 8 個樣本(純粹的壓縮器 $\downarrow 8$)沒有——高頻會反摺進低頻帶
deci_signal = decimate(signal, 8);先做低通濾波(8 階 Chebyshev I 型,截止頻率 $0.8\,(f_s/2)/8$,以前向—後向方式施加),再保留每第 8 個樣本有——高於新 Nyquist 頻率的頻帶會先被移除
呼び出しその内容エイリアシング保護
down_signal = downsample(signal, 8);8 個おきの標本だけを残す(純粋な圧縮器 $\downarrow 8$)なし——高周波が低域へ折り返す
deci_signal = decimate(signal, 8);低域通過フィルタ(8 次チェビシェフ I 型、遮断周波数 $0.8\,(f_s/2)/8$、前向き・後ろ向きに適用)をかけてから、8 個おきの標本を残すあり——新しいナイキスト周波数より上の帯域が先に取り除かれる
Slide takeaway(test_aliasing.m)投影片重點(test_aliasing.m)スライドの要点(test_aliasing.m)

Watch for high-frequency content before resampling: anything above the new Nyquist frequency folds down and mixes with the genuine low-frequency components. decimate lowpass-filters before reducing the rate; downsample does not. If the signal has any energy above the new Nyquist frequency, use decimate (or resample), never bare downsample.重新取樣要注意高頻成分的混疊!高頻成分會反摺到低頻、與其他低頻成分混合。decimate 會在降低取樣頻率之前先做低通濾波;downsample 不會。只要訊號在新的 Nyquist 頻率以上還有任何能量,就該用 decimate(或 resample),絕不要用光禿禿的 downsample。再標本化の前に高周波成分に注意すること。新しいナイキスト周波数より上にあるものはすべて折り返し、本物の低周波成分と混ざり合う。decimate はレートを下げる前に低域通過フィルタをかけるが、downsample はかけない。信号が新しいナイキスト周波数より上にわずかでもエネルギーをもつなら、decimate(あるいは resample)を使い、裸の downsample は決して使ってはならない。

7.5.2 resample and rat(任意倍率重新取樣)7.5.2 resample 與 rat(任意倍率重新取樣)7.5.2 resample と rat(任意倍率の再標本化)

Y = resample(X, P, Q) resamples X at $P/Q$ times the original rate (polyphase implementation; length of Y is $\lceil P/Q \cdot \mathrm{length}(X)\rceil$). It applies an anti-aliasing lowpass FIR filter during the conversion and compensates the filter delay. [N, D] = rat(X, tol) returns integers with $|N/D - X| \le tol$ (continued-fraction truncation; default tolerance $10^{-6}\,\lVert X\rVert_1$) — the standard way to get $P$ and $Q$ from a ratio of sampling rates:Y = resample(X, P, Q) 會把 X 重新取樣成原取樣率的 $P/Q$ 倍(採多相實現;Y 的長度為 $\lceil P/Q \cdot \mathrm{length}(X)\rceil$)。轉換過程中它會施加一個抗混疊低通 FIR 濾波器,並補償濾波器的延遲。[N, D] = rat(X, tol) 則回傳滿足 $|N/D - X| \le tol$ 的整數(以連分數截斷求得;預設容忍度為 $10^{-6}\,\lVert X\rVert_1$)——這是從兩個取樣率的比值求出 $P$ 與 $Q$ 的標準做法:Y = resample(X, P, Q) は X を元のレートの $P/Q$ 倍に再標本化する(多相実現。Y の長さは $\lceil P/Q \cdot \mathrm{length}(X)\rceil$ である)。変換の途中でアンチエイリアス低域通過 FIR フィルタをかけ、そのフィルタ遅延も補償する。[N, D] = rat(X, tol) は $|N/D - X| \le tol$ を満たす整数を返す(連分数の打ち切りによる。既定の許容値は $10^{-6}\,\lVert X\rVert_1$)——標本化レートの比から $P$ と $Q$ を求める標準的な方法である:

org_SR = 2000;                       % original rate (Hz)
new_SR3 = 300;                       % target rate (Hz)
[p, q] = rat(new_SR3/org_SR);        % p = 3, q = 20
new_signal3 = resample(org_signal, p, q);
new_taxis3 = (1:length(new_signal3))'/new_SR3;   % REBUILD the time axis!
Rebuild the time axis(別忘記重新取樣後要重新定義時間軸!!)重建時間軸(別忘記重新取樣後要重新定義時間軸!!)時間軸を作り直す(再標本化のあとは時間軸を定義し直すのを忘れずに!)

After resampling, the old time vector no longer matches the data length or spacing. Always recompute it from the new sampling rate, e.g. t_new = (1:length(y))'/new_SR; — forgetting this stretches or squeezes the waveform on every later plot and analysis.重新取樣之後,舊的時間向量在長度與間距上都已經對不上資料了。務必用新的取樣率重新算一次,例如 t_new = (1:length(y))'/new_SR;——忘了這一步,之後每一張圖與每一項分析上的波形都會被拉長或壓扁。再標本化のあと、古い時間ベクトルはデータの長さにも間隔にももう合っていない。かならず新しい標本化レートから計算し直すこと。たとえば t_new = (1:length(y))'/new_SR; とする——これを忘れると、以後のすべての図と解析で波形が引き伸ばされたり押し縮められたりする。

Resampling function cheat-sheet(重新取樣常用函式)重新取樣常用函式一覽再標本化でよく使う関数の早見表
FunctionPurpose(用途)
interp(x, L)內插訊號以提高取樣頻率 — interpolate, rate × L (anti-imaging filter built in)
decimate(x, M)低通濾波過後降低取樣頻率 — lowpass then rate ÷ M
downsample(x, M) / upsample(x, L)bare compressor / bare zero-insertion expander (no filters)
resample(x, P, Q)執行 P 倍的 interp 提高取樣頻率,再執行 Q 倍的 decimate 降低取樣頻率 — rational P/Q change, polyphase
rat(x, tol)找出最接近輸入數值的分數形式(P/Q)— rational approximation via continued fractions
函式用途
interp(x, L)內插訊號以提高取樣頻率——倍率 × L(已內建去鏡像濾波器)
decimate(x, M)低通濾波過後降低取樣頻率——先低通,再 ÷ M
downsample(x, M) / upsample(x, L)光禿禿的壓縮器/光禿禿的補零擴張器(都沒有濾波器)
resample(x, P, Q)執行 P 倍的 interp 提高取樣頻率,再執行 Q 倍的 decimate 降低取樣頻率——有理數 P/Q 倍率轉換,多相實現
rat(x, tol)找出最接近輸入數值的分數形式(P/Q)——以連分數做有理數近似
関数用途
interp(x, L)補間によって標本化周波数を上げる — レート × L(アンチイメージングフィルタ内蔵)
decimate(x, M)低域通過フィルタをかけてから標本化周波数を下げる — 先に低域通過、そのうえでレート ÷ M
downsample(x, M) / upsample(x, L)裸の圧縮器/裸の零挿入拡張器(どちらもフィルタなし)
resample(x, P, Q)P 倍の interp で標本化周波数を上げ、続いて Q 倍の decimate で下げる — 有理数 P/Q のレート変換、多相実現
rat(x, tol)入力の数値に最も近い分数の形(P/Q)を求める — 連分数による有理数近似

7.6 Summary7.6 總結7.6 まとめ

Downsampling $\downarrow M$(降取樣)Upsampling $\uparrow L$(升取樣)
Sampling ratereduced by $M$increased by $L$
Sample periodincreases: $T' = MT$decreases: $T' = T/L$
With its lowpass filter, calleddecimation(抽取)interpolation(內插)
Spectrumstretched by $M$, amplitude $\times \tfrac1M$, $M$ copiescompressed by $L$, $L-1$ images appear
Hazardaliasing(混疊)— irreversibleimaging(鏡像)— removable
Filterbefore $\downarrow M$: gain 1, cutoff $\pi/M$after $\uparrow L$: gain $L$, cutoff $\pi/L$
Informationlost above $\pi/M$fully preserved
降取樣 $\downarrow M$升取樣 $\uparrow L$
取樣率降為 $1/M$提高 $L$ 倍
取樣週期變長:$T' = MT$變短:$T' = T/L$
加上低通濾波器後稱為抽取(decimation)內插(interpolation)
頻譜被拉寬 $M$ 倍、振幅 $\times \tfrac1M$、共 $M$ 個複本被壓縮 $L$ 倍、出現 $L-1$ 個映像
風險混疊(aliasing)——不可逆映像(imaging)——可以濾掉
濾波器位置$\downarrow M$ 之前:增益 1、截止 $\pi/M$$\uparrow L$ 之後:增益 $L$、截止 $\pi/L$
資訊$\pi/M$ 以上的部分永久失去完整保留
ダウンサンプリング $\downarrow M$アップサンプリング $\uparrow L$
標本化レート$M$ 分の 1 になる$L$ 倍になる
標本周期長くなる:$T' = MT$短くなる:$T' = T/L$
低域通過フィルタを伴うときの呼び名間引き(decimation)補間(interpolation)
スペクトル$M$ 倍に引き伸ばされ、振幅は $\times \tfrac1M$、複製は $M$ 個$L$ 倍に圧縮され、$L-1$ 個のイメージが現れる
危険エイリアシング — 不可逆イメージング — 取り除ける
フィルタ$\downarrow M$ の前:利得 1、遮断 $\pi/M$$\uparrow L$ の後:利得 $L$、遮断 $\pi/L$
情報$\pi/M$ より上は失われる完全に保たれる
Downsampling spectrum降取樣的頻譜ダウンサンプリングのスペクトル

$X_d(e^{j\omega}) = \dfrac{1}{M}\displaystyle\sum_{i=0}^{M-1} X\big(e^{j(\omega-2\pi i)/M}\big)$ — stretch by $M$, average $M$ copies. Safe iff $\omega_N \le \pi/M$.$X_d(e^{j\omega}) = \dfrac{1}{M}\displaystyle\sum_{i=0}^{M-1} X\big(e^{j(\omega-2\pi i)/M}\big)$——拉寬 $M$ 倍,再把 $M$ 個複本平均。當且僅當 $\omega_N \le \pi/M$ 時安全。$X_d(e^{j\omega}) = \dfrac{1}{M}\displaystyle\sum_{i=0}^{M-1} X\big(e^{j(\omega-2\pi i)/M}\big)$——$M$ 倍に引き伸ばし、$M$ 個の複製を平均する。$\omega_N \le \pi/M$ のとき、かつそのときにかぎり安全である。

Upsampling spectrum升取樣的頻譜アップサンプリングのスペクトル

$X_e(e^{j\omega}) = X(e^{j\omega L})$ — compress by $L$; remove images with lowpass of gain $L$, cutoff $\pi/L$; then $x_i[n]=x_c(nT/L)$ exactly.$X_e(e^{j\omega}) = X(e^{j\omega L})$——壓縮 $L$ 倍;用增益 $L$、截止 $\pi/L$ 的低通去掉映像;於是 $x_i[n]=x_c(nT/L)$ 完全成立。$X_e(e^{j\omega}) = X(e^{j\omega L})$——$L$ 倍に圧縮する。利得 $L$、遮断 $\pi/L$ の低域通過でイメージを取り除けば、$x_i[n]=x_c(nT/L)$ が厳密に成り立つ。

Rational rate change有理數倍率轉換有理数倍のレート変換

$\uparrow L \to$ lowpass (gain $L$, cutoff $\min(\pi/L,\pi/M)$) $\to\ \downarrow M$ gives $T' = MT/L$. Interpolate first so information is only lost when unavoidable.$\uparrow L \to$ 低通(增益 $L$、截止 $\min(\pi/L,\pi/M)$)$\to\ \downarrow M$,得到 $T' = MT/L$。先內插,這樣才只在不得已時才失去資訊。$\uparrow L \to$ 低域通過(利得 $L$、遮断 $\min(\pi/L,\pi/M)$)$\to\ \downarrow M$ とすれば $T' = MT/L$ が得られる。先に補間すること。そうすれば情報が失われるのは、やむを得ない場合だけになる。

Practical interpolators實用的內插器実用的な補間器

ZOH repeats samples; linear connects them ($h_{\mathrm{lin}} = $ triangle, $H_{\mathrm{lin}} = \frac{1}{L}\big[\frac{\sin(\omega L/2)}{\sin(\omega/2)}\big]^2$). Both leave residual images — fine only when oversampled.ZOH 重複樣本;線性內插把樣本連成直線($h_{\mathrm{lin}} = $ 三角形,$H_{\mathrm{lin}} = \frac{1}{L}\big[\frac{\sin(\omega L/2)}{\sin(\omega/2)}\big]^2$)。兩者都會留下殘餘映像——只有在大幅過取樣時才夠用。ZOH は標本を繰り返し、線形補間は標本どうしを直線で結ぶ($h_{\mathrm{lin}} = $ 三角形、$H_{\mathrm{lin}} = \frac{1}{L}\big[\frac{\sin(\omega L/2)}{\sin(\omega/2)}\big]^2$)。どちらもイメージを残す——大きく過標本化されているときにかぎって使える。

MATLABMATLABMATLAB

decimate = filter + $\downarrow M$; downsample = bare $\downarrow M$ (danger); interp = $\uparrow L$ + filter; resample(x,P,Q) = polyphase $P/Q$; get $P,Q$ with rat.decimate = 濾波 + $\downarrow M$;downsample = 光禿禿的 $\downarrow M$(危險);interp = $\uparrow L$ + 濾波;resample(x,P,Q) = 多相的 $P/Q$ 轉換;$P,Q$ 用 rat 求得。decimate = フィルタ + $\downarrow M$、downsample = 裸の $\downarrow M$(危険)、interp = $\uparrow L$ + フィルタ、resample(x,P,Q) = 多相による $P/Q$ 変換。$P,Q$ は rat で求める。

Golden rules黃金守則黄金律

(1) Filter before you compress, after you expand. (2) Aliasing is forever; images wash off. (3) Rebuild the time axis after every rate change.(1) 壓縮之前要濾波,擴張之後要濾波。(2) 混疊是永久的,映像則洗得掉。(3) 每做一次倍率轉換,就要重建時間軸。(1) 圧縮する前に、そして拡張した後にフィルタをかける。(2) エイリアシングは永久に残るが、イメージは洗い落とせる。(3) レートを変えたら毎回、時間軸を作り直す。

Exercises習題演習

All five problems of ICE503 DSP Homework #7, restated with full worked solutions.ICE503 DSP 作業 #7 的全部五題,重新敘述並附完整解答。ICE503 DSP 宿題 #7 の全 5 題を、完全な解答つきで述べ直したものである。

Exercise 1 — Multirate system analysis (C/D → ↑L → H → ↓M → D/C)習題 1 — 多率系統分析(C/D → ↑L → H → ↓M → D/C)演習 1 — マルチレート系の解析(C/D → ↑L → H → ↓M → D/C)

Problem: Consider the system below. Assume $R_c(j\Omega)$ is bandlimited, $R_c(j\Omega) = 0$ for $|\Omega| \ge 2\pi(1000)$, with the triangular shape of Fig. 2 of the homework (peak $R_c(0)$ at $\Omega = 0$, decreasing linearly to zero at $|\Omega| = 2\pi(1000)$).題目:考慮下面的系統。假設 $R_c(j\Omega)$ 是帶限的,當 $|\Omega| \ge 2\pi(1000)$ 時 $R_c(j\Omega) = 0$,形狀為作業圖 2 的三角形(在 $\Omega = 0$ 處有峰值 $R_c(0)$,線性遞減到 $|\Omega| = 2\pi(1000)$ 處歸零)。問題:下の系を考える。$R_c(j\Omega)$ は帯域制限されており、$|\Omega| \ge 2\pi(1000)$ では $R_c(j\Omega) = 0$ で、形は宿題の図 2 の三角形($\Omega = 0$ でピーク $R_c(0)$ をとり、$|\Omega| = 2\pi(1000)$ で線形に零まで減少する)とする。

rc(t) C/D T₁ r[n] ↑L x[n] H(e^jω) LPF, cutoff ω₀ v[n] ↓M y[n] D/C T₃ sc(t)
The Exercise 1 system: C/D at period $T_1$, expander ↑L, ideal lowpass $H(e^{j\omega})$ (gain 1, cutoff $\omega_0$), compressor ↓M, D/C at period $T_3$.習題 1 的系統:週期 $T_1$ 的 C/D、擴張器 ↑L、理想低通 $H(e^{j\omega})$(增益 1、截止 $\omega_0$)、壓縮器 ↓M,以及週期 $T_3$ 的 D/C。演習 1 の系:周期 $T_1$ の C/D、拡張器 ↑L、理想低域通過 $H(e^{j\omega})$(利得 1、遮断 $\omega_0$)、圧縮器 ↓M、そして周期 $T_3$ の D/C。

(a) For $L = 3$, $T_1 = \tfrac{1}{2000}$ s, and $H(e^{j\omega}) = 1$ for $|\omega|\le\omega_0$, $0$ otherwise — sketch $R(e^{j\omega})$ and $X(e^{j\omega})$.
(b) For $M = 2$, choose nonzero $\omega_0$ and $T_2$ such that $y[n] = \alpha\, r_c(nT_2)$ for some nonzero constant $\alpha$.
(c) Using the $\omega_0$ from (b), determine $T_3$ such that $s_c(t) = \beta\, r_c(t)$ for some nonzero $\beta$.
(d) Now let $M = 3$ and $T_3 = \tfrac{1}{2000}$. If the output must be $s_c(t) = r_c\!\big(t - \tfrac{1}{1000}\big)$, is it possible to obtain $s[n] \,(= y[n])$ from $r[n]$? If so, what should $H(e^{j\omega})$ be?
(a) 當 $L = 3$、$T_1 = \tfrac{1}{2000}$ s,且 $|\omega|\le\omega_0$ 時 $H(e^{j\omega}) = 1$、其餘為 $0$——畫出 $R(e^{j\omega})$ 與 $X(e^{j\omega})$。
(b) 當 $M = 2$,選出非零的 $\omega_0$ 與 $T_2$,使得 $y[n] = \alpha\, r_c(nT_2)$($\alpha$ 為某個非零常數)。
(c) 沿用 (b) 的 $\omega_0$,決定 $T_3$ 使得 $s_c(t) = \beta\, r_c(t)$($\beta$ 為某個非零常數)。
(d) 現在令 $M = 3$、$T_3 = \tfrac{1}{2000}$。若輸出必須是 $s_c(t) = r_c\!\big(t - \tfrac{1}{1000}\big)$,有沒有可能從 $r[n]$ 得到 $s[n] \,(= y[n])$?若可以,$H(e^{j\omega})$ 應該是什麼?
(a) $L = 3$、$T_1 = \tfrac{1}{2000}$ s とし、$|\omega|\le\omega_0$ では $H(e^{j\omega}) = 1$、それ以外では $0$ とする——$R(e^{j\omega})$ と $X(e^{j\omega})$ を描け。
(b) $M = 2$ のとき、ある零でない定数 $\alpha$ に対して $y[n] = \alpha\, r_c(nT_2)$ となるような、零でない $\omega_0$ と $T_2$ を選べ。
(c) (b) で得た $\omega_0$ を用いて、ある零でない $\beta$ に対して $s_c(t) = \beta\, r_c(t)$ となる $T_3$ を定めよ。
(d) いま $M = 3$、$T_3 = \tfrac{1}{2000}$ とする。出力が $s_c(t) = r_c\!\big(t - \tfrac{1}{1000}\big)$ でなければならないとき、$r[n]$ から $s[n] \,(= y[n])$ を得ることは可能か。可能ならば $H(e^{j\omega})$ はどうあるべきか。

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

(a) Sketch $R(e^{j\omega})$ and $X(e^{j\omega})$(a) 畫出 $R(e^{j\omega})$ 與 $X(e^{j\omega})$(a) $R(e^{j\omega})$ と $X(e^{j\omega})$ を描く

Sampling at $f_1 = 1/T_1 = 2000$ Hz a signal whose highest frequency is 1000 Hz puts the band edge exactly at $\Omega_N T_1 = 2\pi(1000)/2000 = \pi$ — critical sampling, no aliasing, the spectrum fills the whole $[-\pi,\pi]$ interval:以 $f_1 = 1/T_1 = 2000$ Hz 去取樣一個最高頻率為 1000 Hz 的訊號,會把頻帶邊界剛好放在 $\Omega_N T_1 = 2\pi(1000)/2000 = \pi$——這是臨界取樣,沒有混疊,而頻譜正好填滿整個 $[-\pi,\pi]$ 區間:最高周波数が 1000 Hz の信号を $f_1 = 1/T_1 = 2000$ Hz で標本化すると、帯域端はちょうど $\Omega_N T_1 = 2\pi(1000)/2000 = \pi$ に来る——臨界標本化であり、エイリアシングはなく、スペクトルは区間 $[-\pi,\pi]$ の全体を埋め尽くす:

$$R(e^{j\omega}) = \frac{1}{T_1}\sum_{k} R_c\!\left(j\Big(\frac{\omega - 2\pi k}{T_1}\Big)\right) \;\Rightarrow\; \text{triangles of peak } \frac{R_c(0)}{T_1} = 2000\,R_c(0) \text{ centered at } \omega = 2\pi k,$$$$R(e^{j\omega}) = \frac{1}{T_1}\sum_{k} R_c\!\left(j\Big(\frac{\omega - 2\pi k}{T_1}\Big)\right) \;\Rightarrow\; \text{peak } \frac{R_c(0)}{T_1} = 2000\,R_c(0),\ \text{centered at } \omega = 2\pi k,$$$$R(e^{j\omega}) = \frac{1}{T_1}\sum_{k} R_c\!\left(j\Big(\frac{\omega - 2\pi k}{T_1}\Big)\right) \;\Rightarrow\; \text{triangles of peak } \frac{R_c(0)}{T_1} = 2000\,R_c(0) \text{ centered at } \omega = 2\pi k,$$

each triangle reaching zero at odd multiples of $\pi$. The expander output is $X(e^{j\omega}) = R(e^{j3\omega})$: the same shape compressed by $L=3$, now periodic with period $2\pi/3$ — a baseband triangle on $|\omega| \le \pi/3$ plus images centered at $\pm 2\pi/3$ (and $2\pi$-translates). Both are sketched below (taking $R_c(0)=1$).每個三角形在 $\pi$ 的奇數倍處歸零。擴張器的輸出是 $X(e^{j\omega}) = R(e^{j3\omega})$:同樣的形狀被壓縮 $L=3$ 倍,現在的週期變成 $2\pi/3$——在 $|\omega| \le \pi/3$ 上有一個基頻三角形,另外在 $\pm 2\pi/3$(以及平移 $2\pi$ 的位置)有映像。兩者都畫在下面(取 $R_c(0)=1$)。各三角形は $\pi$ の奇数倍のところで零になる。拡張器の出力は $X(e^{j\omega}) = R(e^{j3\omega})$ であり、同じ形が $L=3$ 倍に圧縮されて、周期はいまや $2\pi/3$ である——$|\omega| \le \pi/3$ 上の基底帯域の三角形に加え、$\pm 2\pi/3$(および $2\pi$ だけ平行移動した位置)を中心とするイメージが現れる。以下に両方を描いた($R_c(0)=1$ とした)。

2026-06-12T22:24:32.255906 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 500 1000 1500 2000 amplitude R(e^jw) = (1/T1) Rc(jw/T1): peak 2000, fills |w| <= pi 0 500 1000 1500 2000 amplitude X(e^jw) = R(e^j3w): period 2pi/3; dashed: H with w0 = pi/3 −2 −1 0 1 2 w / pi 0 250 500 750 1000 amplitude Y(e^jw) after compression by M = 2: baseband to 2pi/3 (y[n] = a rc(nT2))
Fig. 7-10 — Exercise 1(a)/(b): $R(e^{j\omega})$ (top); $X(e^{j\omega}) = R(e^{j3\omega})$ with the part (b) filter $\omega_0 = \pi/3$ dashed (middle); spectrum of $y[n]$ after $\downarrow 2$ (bottom) — a clean stretched triangle, i.e. samples of $r_c$ at rate 3000 Hz.圖 7-10 — 習題 1(a)/(b):上為 $R(e^{j\omega})$;中為 $X(e^{j\omega}) = R(e^{j3\omega})$,虛線是 (b) 小題的濾波器 $\omega_0 = \pi/3$;下為經過 $\downarrow 2$ 之後 $y[n]$ 的頻譜——一個乾淨的、被拉寬的三角形,也就是以 3000 Hz 取樣的 $r_c$ 樣本。図 7-10 — 演習 1(a)/(b):上は $R(e^{j\omega})$、中は $X(e^{j\omega}) = R(e^{j3\omega})$ で、破線は (b) のフィルタ $\omega_0 = \pi/3$、下は $\downarrow 2$ を通したあとの $y[n]$ のスペクトル——きれいに引き伸ばされた三角形、すなわち 3000 Hz のレートで取った $r_c$ の標本である。

(b) Choose $\omega_0$ and $T_2$ for $y[n] = \alpha\, r_c(nT_2)$ — with $M=2$(b) 在 $M=2$ 下選出使 $y[n] = \alpha\, r_c(nT_2)$ 的 $\omega_0$ 與 $T_2$(b) $M=2$ のもとで $y[n] = \alpha\, r_c(nT_2)$ となる $\omega_0$ と $T_2$ を選ぶ

Step 1 — kill the images. After $\uparrow 3$ the desired baseband occupies $|\omega| \le \pi/3$ and the images begin right at $\pi/3$. The only cutoff that keeps all of the baseband and none of the images is $$\boxed{\omega_0 = \frac{\pi}{3}}$$第 1 步 — 去掉映像。經過 $\uparrow 3$ 之後,我們要的基頻佔 $|\omega| \le \pi/3$,而映像正好從 $\pi/3$ 開始。唯一能完整保留基頻又完全不放進映像的截止頻率是 $$\boxed{\omega_0 = \frac{\pi}{3}}$$第 1 段 — イメージを消す。$\uparrow 3$ のあと、欲しい基底帯域は $|\omega| \le \pi/3$ を占め、イメージはちょうど $\pi/3$ から始まる。基底帯域をすべて残し、イメージを一つも通さない遮断周波数は次の一つだけである $$\boxed{\omega_0 = \frac{\pi}{3}}$$
Step 2 — check the compressor. $v[n]$ is bandlimited to $\pi/3$; downsampling by $M=2$ stretches this to $2\pi/3 < \pi$ — no aliasing. ✓第 2 步 — 檢查壓縮器。$v[n]$ 帶限於 $\pi/3$;以 $M=2$ 降取樣會把它拉寬到 $2\pi/3 < \pi$——不會混疊。✓第 2 段 — 圧縮器を確かめる。$v[n]$ は $\pi/3$ に帯域制限されている。$M=2$ でダウンサンプリングすると、これは $2\pi/3 < \pi$ まで引き伸ばされる——エイリアシングは起きない。✓
Step 3 — effective sampling period. The chain C/D($T_1$) → $\uparrow 3$ → ideal LPF → $\downarrow 2$ is equivalent to sampling $r_c(t)$ with period $$T_2 = \frac{M}{L}T_1 = \frac{2}{3}\cdot\frac{1}{2000} = \boxed{\frac{1}{3000}\ \text{s}}\qquad (f = 3000\ \text{Hz}).$$ So $y[n] = \alpha\, r_c(n/3000)$. (For the record, since $H$ has gain 1 instead of $L=3$, and $\downarrow 2$ contributes $\tfrac12$, one finds $\alpha = 1/3$ — not required.)第 3 步 — 等效取樣週期。C/D($T_1$) → $\uparrow 3$ → 理想低通 → $\downarrow 2$ 這一串,等價於以下列週期對 $r_c(t)$ 取樣 $$T_2 = \frac{M}{L}T_1 = \frac{2}{3}\cdot\frac{1}{2000} = \boxed{\frac{1}{3000}\ \text{s}}\qquad (f = 3000\ \text{Hz}).$$ 所以 $y[n] = \alpha\, r_c(n/3000)$。(順帶一提,由於 $H$ 的增益是 1 而不是 $L=3$,而 $\downarrow 2$ 又貢獻了 $\tfrac12$,可得 $\alpha = 1/3$——本題並未要求。)第 3 段 — 実効的な標本周期。C/D($T_1$) → $\uparrow 3$ → 理想 LPF → $\downarrow 2$ という連なりは、$r_c(t)$ を次の周期で標本化することと等価である $$T_2 = \frac{M}{L}T_1 = \frac{2}{3}\cdot\frac{1}{2000} = \boxed{\frac{1}{3000}\ \text{s}}\qquad (f = 3000\ \text{Hz}).$$ よって $y[n] = \alpha\, r_c(n/3000)$ である。(念のために言えば、$H$ の利得が $L=3$ ではなく 1 であり、$\downarrow 2$ が $\tfrac12$ を与えるので $\alpha = 1/3$ となる——本問では問われていない。)

(c) Choose $T_3$ for $s_c(t) = \beta\, r_c(t)$(c) 選出使 $s_c(t) = \beta\, r_c(t)$ 的 $T_3$(c) $s_c(t) = \beta\, r_c(t)$ となる $T_3$ を選ぶ

$y[n]$ holds samples of $r_c$ taken every $T_2 = 1/3000$ s, and $y[n]$ is alias-free. The ideal D/C converter reconstructs the original continuous-time signal precisely when its period matches the actual sample spacing:$y[n]$ 裝的是每隔 $T_2 = 1/3000$ s 取一次的 $r_c$ 樣本,而且 $y[n]$ 沒有混疊。理想的 D/C 轉換器,只有在它的週期與實際的樣本間距相符時,才會精確重建出原本的連續時間訊號:$y[n]$ は $T_2 = 1/3000$ s ごとに取られた $r_c$ の標本を保持しており、しかも $y[n]$ にはエイリアシングがない。理想 D/C 変換器は、その周期が実際の標本間隔と一致するときにかぎって、元の連続時間信号を厳密に再構成する:

$$\boxed{T_3 = T_2 = \frac{1}{3000}\ \text{s}} \;\Rightarrow\; s_c(t) = \beta\, r_c(t).$$$$\boxed{T_3 = T_2 = \frac{1}{3000}\ \text{s}} \;\Rightarrow\; s_c(t) = \beta\, r_c(t).$$$$\boxed{T_3 = T_2 = \frac{1}{3000}\ \text{s}} \;\Rightarrow\; s_c(t) = \beta\, r_c(t).$$

(Any other $T_3$ would produce a time-scaled $r_c(t\,T_2/T_3)$, not $\beta r_c(t)$.)(任何其他的 $T_3$ 都只會得到時間被縮放的 $r_c(t\,T_2/T_3)$,而不是 $\beta r_c(t)$。)(これ以外の $T_3$ をとると、時間軸の伸縮された $r_c(t\,T_2/T_3)$ が得られるだけで、$\beta r_c(t)$ にはならない。)

(d) $M = 3$, $T_3 = \tfrac{1}{2000}$, target $s_c(t) = r_c\big(t - \tfrac{1}{1000}\big)$(d) $M = 3$、$T_3 = \tfrac{1}{2000}$,目標為 $s_c(t) = r_c\big(t - \tfrac{1}{1000}\big)$(d) $M = 3$、$T_3 = \tfrac{1}{2000}$、目標は $s_c(t) = r_c\big(t - \tfrac{1}{1000}\big)$

Step 1 — what must $y[n]$ be? With $T_3 = 1/2000$ and D/C ideal, $$y[n] = s_c(nT_3) = r_c\!\Big(nT_3 - \tfrac{1}{1000}\Big) = r_c\big((n-2)T_3\big) = r[n-2],$$ because $\tfrac{1}{1000} = 2T_3$ and $r[n] = r_c(nT_1)$ with $T_1 = T_3$. So we need a pure 2-sample delay of $r[n]$.第 1 步 — $y[n]$ 必須是什麼?當 $T_3 = 1/2000$ 且 D/C 為理想時, $$y[n] = s_c(nT_3) = r_c\!\Big(nT_3 - \tfrac{1}{1000}\Big) = r_c\big((n-2)T_3\big) = r[n-2],$$ 因為 $\tfrac{1}{1000} = 2T_3$,且 $r[n] = r_c(nT_1)$、$T_1 = T_3$。所以我們需要的是 $r[n]$ 的一個純粹延遲 2 個樣本。第 1 段 — $y[n]$ は何でなければならないか。$T_3 = 1/2000$ で D/C が理想ならば、 $$y[n] = s_c(nT_3) = r_c\!\Big(nT_3 - \tfrac{1}{1000}\Big) = r_c\big((n-2)T_3\big) = r[n-2],$$ である。$\tfrac{1}{1000} = 2T_3$ であり、$T_1 = T_3$ のもとで $r[n] = r_c(nT_1)$ だからである。したがって必要なのは、$r[n]$ の純粋な2 標本ぶんの遅延である。
Step 2 — can ↑3 → H → ↓3 produce a delay of 2? Yes. With $L = M = 3$ the rate is unchanged. A delay of 2 at the output rate equals a delay of $2L = 6$ at the high (expanded) rate, and 6 is an integer — so it is realizable by an LTI filter at the high rate.第 2 步 — ↑3 → H → ↓3 做得出延遲 2 嗎?可以。當 $L = M = 3$ 時取樣率不變。在輸出取樣率上延遲 2,等於在(擴張後的)高取樣率上延遲 $2L = 6$,而 6 是整數——所以可以用高取樣率上的一個 LTI 濾波器實現。第 2 段 — ↑3 → H → ↓3 で遅延 2 を作れるか。作れる。$L = M = 3$ ではレートが変わらない。出力レートにおける 2 の遅延は、(拡張後の)高いレートにおける $2L = 6$ の遅延に等しく、6 は整数である——したがって高いレートの LTI フィルタで実現できる。
Step 3 — specify $H$. Take the ideal interpolation filter (gain $L = 3$, cutoff $\pi/3$, which both removes the expander images and prevents aliasing in $\downarrow 3$) and add the 6-sample delay: $$\boxed{H(e^{j\omega}) = \begin{cases} 3\,e^{-j6\omega}, & |\omega| < \pi/3 \\ 0, & \pi/3 \le |\omega| \le \pi \end{cases}}$$ Then $\uparrow 3 \to H \to \downarrow 3$ gives exactly $y[n] = r[n-2]$, hence $s_c(t) = r_c(t - \tfrac{1}{1000})$. Yes, it is possible.第 3 步 — 寫出 $H$。取理想的內插濾波器(增益 $L = 3$、截止 $\pi/3$,它同時負責去掉擴張器的映像並防止 $\downarrow 3$ 產生混疊),再加上 6 個樣本的延遲: $$\boxed{H(e^{j\omega}) = \begin{cases} 3\,e^{-j6\omega}, & |\omega| < \pi/3 \\ 0, & \pi/3 \le |\omega| \le \pi \end{cases}}$$ 如此 $\uparrow 3 \to H \to \downarrow 3$ 剛好給出 $y[n] = r[n-2]$,因此 $s_c(t) = r_c(t - \tfrac{1}{1000})$。是的,做得到。第 3 段 — $H$ を書き下す。理想補間フィルタ(利得 $L = 3$、遮断 $\pi/3$。これが拡張器のイメージを取り除き、同時に $\downarrow 3$ でのエイリアシングも防ぐ)をとり、そこに 6 標本の遅延を加える: $$\boxed{H(e^{j\omega}) = \begin{cases} 3\,e^{-j6\omega}, & |\omega| < \pi/3 \\ 0, & \pi/3 \le |\omega| \le \pi \end{cases}}$$ こうすれば $\uparrow 3 \to H \to \downarrow 3$ はちょうど $y[n] = r[n-2]$ を与え、したがって $s_c(t) = r_c(t - \tfrac{1}{1000})$ となる。そう、可能である。

Note the delay had to be an integer multiple of $M = 3$ at the high rate (here $6 = 2\cdot 3$); a half-sample-type shift such as $r_c(t - \tfrac{1}{4000})$ would still be realizable with a fractional-delay allpass term $e^{-j\omega d}$, $d$ non-integer — the multirate chain is more flexible than a plain delay line.注意這個延遲在高取樣率上必須是 $M = 3$ 的整數倍(這裡是 $6 = 2\cdot 3$);至於像 $r_c(t - \tfrac{1}{4000})$ 這種半樣本式的平移,仍然可以用一個分數延遲全通項 $e^{-j\omega d}$($d$ 非整數)做到——多率的架構比單純的延遲線更有彈性。この遅延が高いレートにおいて $M = 3$ の整数倍でなければならなかったことに注意しよう(ここでは $6 = 2\cdot 3$)。$r_c(t - \tfrac{1}{4000})$ のような半標本ぶんのずれであっても、分数遅延の全域通過項 $e^{-j\omega d}$($d$ は非整数)を使えばなお実現できる——マルチレートの構成は、単なる遅延線よりも柔軟なのである。

Exercise 2 — MATLAB: decimate vs downsample on a two-tone signal習題 2 — MATLAB:雙音訊號上的 decimate vs downsample演習 2 — MATLAB:2 音信号に対する decimate と downsample

Problem: Generate $x(t) = \sin(2\pi\,20t) + \sin(2\pi\,100t)$ and sample it at 1000 Hz to obtain $x[n]$. (a) Reduce the rate by 5 using both decimate and downsample; plot each result against $x[n]$. (b) Repeat with factor 8.題目:產生 $x(t) = \sin(2\pi\,20t) + \sin(2\pi\,100t)$ 並以 1000 Hz 取樣得到 $x[n]$。(a) 分別用 decimate 與 downsample 把取樣率降低 5 倍,並把各自的結果與 $x[n]$ 疊在一起畫出。(b) 換成 8 倍再做一次。問題:$x(t) = \sin(2\pi\,20t) + \sin(2\pi\,100t)$ を生成し、1000 Hz で標本化して $x[n]$ を得よ。(a) decimate と downsample の両方を使ってレートを 5 分の 1 にし、それぞれの結果を $x[n]$ と重ねて描け。(b) 因子 8 で同じことを繰り返せ。

Click to reveal solution點擊展開解答クリックして解答を表示
fs = 1000;  t = 0:1/fs:2-1/fs;
x  = sin(2*pi*20*t) + sin(2*pi*100*t);

for M = [5 8]                          % (a) M = 5, (b) M = 8
    x_down = downsample(x, M);         % bare compressor, no filter
    x_deci = decimate(x, M);           % Chebyshev LPF, then compressor
    t_M    = downsample(t, M);

    figure;
    subplot(2,1,1);
    plot(t, x, 'Color', [.75 .75 .75]); hold on;
    stem(t_M, x_down, '.'); xlim([0 0.25]);
    title(sprintf('downsample, M = %d  (fs'' = %g Hz)', M, fs/M));
    subplot(2,1,2);
    plot(t, x, 'Color', [.75 .75 .75]); hold on;
    stem(t_M, x_deci, '.'); xlim([0 0.25]);
    title(sprintf('decimate, M = %d', M));
    xlabel('time (s)');
end
2026-06-12T22:24:32.674065 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.00 0.05 0.10 0.15 0.20 0.25 −2 −1 0 1 2 downsample by 5 (fs' = 200 Hz) x[n] (1000 Hz) downsample, M=5 0.00 0.05 0.10 0.15 0.20 0.25 −2 −1 0 1 2 downsample by 8 (fs' = 125 Hz) x[n] (1000 Hz) downsample, M=8 0.00 0.05 0.10 0.15 0.20 0.25 time (s) −2 −1 0 1 2 decimate by 5 (prefilter + compress) x[n] (1000 Hz) decimate, M=5 0.00 0.05 0.10 0.15 0.20 0.25 time (s) −2 −1 0 1 2 decimate by 8 (prefilter + compress) x[n] (1000 Hz) decimate, M=8
Fig. 7-11 — Exercise 2 results (regenerated numerically; decimate reproduced as 8th-order Chebyshev-I zero-phase filtering + compression). Left column $M=5$, right column $M=8$; top row downsample, bottom row decimate. Gray: original 1000 Hz signal.圖 7-11 — 習題 2 的結果(以數值方式重現;decimate 以 8 階 Chebyshev I 型零相位濾波加上壓縮來複製)。左欄 $M=5$、右欄 $M=8$;上列為 downsample、下列為 decimate。灰色為原始的 1000 Hz 訊號。図 7-11 — 演習 2 の結果(数値的に再現したもの。decimate は 8 次チェビシェフ I 型の零位相フィルタリングと圧縮によって模している)。左列が $M=5$、右列が $M=8$。上段が downsample、下段が decimate。灰色は元の 1000 Hz の信号である。

What you should observe(觀察與解釋)你應該觀察到什麼何が観察されるはずか

(a) $M = 5$ → $f_s' = 200$ Hz, Nyquist 100 Hz. The 100 Hz tone sits exactly at the new Nyquist frequency. Its retained samples are $\sin(2\pi 100 \cdot 5n/1000) = \sin(\pi n) = 0$ — downsample happens to hit every zero crossing, so the 100 Hz tone silently vanishes and only the 20 Hz tone remains. decimate gives nearly the same 20 Hz result because its lowpass cutoff ($0.8 \times 100 = 80$ Hz) also removes the 100 Hz tone. The two outputs look similar here, but for downsample it is pure luck of sampling phase — a cosine at 100 Hz would have aliased to a frozen $\pm 1$ pattern instead.(a) $M = 5$ → $f_s' = 200$ Hz,Nyquist 頻率 100 Hz。100 Hz 的那個音恰好落在新的 Nyquist 頻率上。它被保留下來的樣本是 $\sin(2\pi 100 \cdot 5n/1000) = \sin(\pi n) = 0$——downsample 剛好每次都踩在零交越點上,於是 100 Hz 的音悄悄消失,只剩下 20 Hz。decimate 給出幾乎相同的 20 Hz 結果,因為它的低通截止頻率($0.8 \times 100 = 80$ Hz)同樣會濾掉 100 Hz。兩者在這裡看起來很像,但對 downsample 而言純粹是取樣相位的運氣——換成 100 Hz 的餘弦波,混疊後會變成一個凍住的 $\pm 1$ 圖樣。(a) $M = 5$ → $f_s' = 200$ Hz、ナイキスト周波数 100 Hz。100 Hz の音は新しいナイキスト周波数にちょうど載っている。残される標本は $\sin(2\pi 100 \cdot 5n/1000) = \sin(\pi n) = 0$ であり——downsample はたまたま零交差ばかりを拾うので、100 Hz の音は音もなく消え、20 Hz の音だけが残る。decimate もほぼ同じ 20 Hz の結果を与える。低域通過の遮断周波数($0.8 \times 100 = 80$ Hz)が同じく 100 Hz を取り除くからである。ここでは二つの出力は似て見えるが、downsample のほうは標本化位相の運のよさにすぎない——100 Hz の余弦波であったなら、凍りついた $\pm 1$ の並びへエイリアスしていたはずである。
(b) $M = 8$ → $f_s' = 125$ Hz, Nyquist 62.5 Hz. Now 100 Hz is above the new Nyquist: with downsample it folds to $125 - 100 = 25$ Hz, and the output is $\sin(2\pi 20t) + $ a false 25 Hz tone — visible as a slow 5 Hz beating envelope against the true 20 Hz component (and clearly a different waveform from the gray original). With decimate the prefilter removes the 100 Hz tone before compression, leaving a clean 20 Hz sinusoid. This is precisely the spectral picture of Fig. 7-4.(b) $M = 8$ → $f_s' = 125$ Hz,Nyquist 頻率 62.5 Hz。現在 100 Hz 高於新的 Nyquist:用 downsample 時它會反摺到 $125 - 100 = 25$ Hz,輸出變成 $\sin(2\pi 20t)$ 加上一個假的 25 Hz 音——表現為與真正的 20 Hz 成分互相拍擊、約 5 Hz 的緩慢包絡(波形明顯和灰色的原始訊號不同)。改用 decimate 時,前置濾波器在壓縮之前就把 100 Hz 去掉了,留下乾淨的 20 Hz 正弦波。這正是圖 7-4 所畫的頻譜圖像。(b) $M = 8$ → $f_s' = 125$ Hz、ナイキスト周波数 62.5 Hz。こんどは 100 Hz が新しいナイキスト周波数より上にある。downsample ではそれが $125 - 100 = 25$ Hz へ折り返し、出力は $\sin(2\pi 20t) + $ 偽の 25 Hz の音となる——本物の 20 Hz 成分とのあいだに生じる、約 5 Hz のゆっくりしたうなりの包絡として見える(灰色の元の波形とは明らかに異なる)。decimate では前置フィルタが圧縮の前に 100 Hz の音を取り除くので、きれいな 20 Hz の正弦波が残る。これはまさに図 7-4 のスペクトル図そのものである。
Conclusion: the difference between the two is simply whether an anti-aliasing lowpass runs first. Whenever the signal still carries energy above the new Nyquist frequency, you must use decimate (or resample).結論:兩者的差別就在於有沒有抗混疊低通濾波。當訊號在新的 Nyquist 頻率以上還有能量時,必須用 decimate(或 resample)。結論:両者の違いは、アンチエイリアス低域通過を先にかけるかどうか、ただそれだけである。信号が新しいナイキスト周波数より上にまだエネルギーを運んでいるときは、かならず decimate(あるいは resample)を使わなければならない。
Exercise 3 — MATLAB: resample + rat on an EMG signal習題 3 — MATLAB:對肌電訊號使用 resample + rat演習 3 — MATLAB:筋電信号に対する resample と rat

Problem: Load EMG_ICA.mat (from demodata_L4.zip, course site) and take channel 1: org_signal = fdata(:,1);, already sampled at 2000 Hz. (a) Use rat and resample to upsample to 5000 Hz, then downsample back to 2000 Hz; plot against the original. What happened? (b) Downsample to 300 Hz, then upsample back to 2000 Hz; plot against the original. What happened?題目:載入 EMG_ICA.mat(來自課程網站的 demodata_L4.zip)並取第 1 通道:org_signal = fdata(:,1);,其取樣率為 2000 Hz。(a) 用 rat 與 resample 升頻到 5000 Hz,再降回 2000 Hz;與原始訊號疊圖比較。發生了什麼事?(b) 降頻到 300 Hz,再升回 2000 Hz;與原始訊號疊圖比較。發生了什麼事?問題:EMG_ICA.mat(授業サイトの demodata_L4.zip に含まれる)を読み込み、第 1 チャネル org_signal = fdata(:,1); を取る。これはすでに 2000 Hz で標本化されている。(a) rat と resample を使って 5000 Hz へアップサンプリングし、そのあと 2000 Hz へ戻せ。元の信号と重ねて描き、何が起きたかを述べよ。(b) 300 Hz へダウンサンプリングし、そのあと 2000 Hz へ戻せ。元の信号と重ねて描き、何が起きたかを述べよ。

Click to reveal solution點擊展開解答クリックして解答を表示
load('EMG_ICA.mat');
org_signal = fdata(:,1);               % channel 1, fs = 2000 Hz
org_SR = 2000;
t_org  = (1:length(org_signal))'/org_SR;

% ---------- (a) 2000 -> 5000 -> 2000 ----------
[p1, q1] = rat(5000/org_SR);           % p1 = 5,  q1 = 2
up_sig   = resample(org_signal, p1, q1);     % now 5000 Hz
[p2, q2] = rat(org_SR/5000);           % p2 = 2,  q2 = 5
back_a   = resample(up_sig, p2, q2);         % back to 2000 Hz
t_a = (1:length(back_a))'/org_SR;

figure; plot(t_org, org_signal); hold on; plot(t_a, back_a);
legend('original 2000 Hz', 'up 5000 \rightarrow down 2000');

% ---------- (b) 2000 -> 300 -> 2000 ----------
[p3, q3] = rat(300/org_SR);            % p3 = 3,  q3 = 20
low_sig  = resample(org_signal, p3, q3);     % now 300 Hz
[p4, q4] = rat(org_SR/300);            % p4 = 20, q4 = 3
back_b   = resample(low_sig, p4, q4);        % back to 2000 Hz
t_b = (1:length(back_b))'/org_SR;

figure; plot(t_org, org_signal); hold on; plot(t_b, back_b);
legend('original 2000 Hz', 'down 300 \rightarrow up 2000');
2026-06-12T22:24:33.029422 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.250 0.275 0.300 0.325 0.350 0.375 0.400 0.425 0.450 −1 0 1 2 (a) upsample then downsample: waveform essentially recovered original (2000 Hz) up 5000 -> down 2000 0.250 0.275 0.300 0.325 0.350 0.375 0.400 0.425 0.450 time (s) −1 0 1 2 (b) downsample then upsample: content above 150 Hz is gone -- smoothed original (2000 Hz) down 300 -> up 2000
Fig. 7-12 — Exercise 3 behavior reproduced on a simulated surface-EMG-like burst signal (bandpass 20–450 Hz noise with burst envelopes, $f_s = 2000$ Hz), since the course .mat file is not redistributable. The phenomena are identical to what you will see with EMG_ICA.mat.圖 7-12 — 習題 3 的現象,以一段模擬的表面肌電爆發訊號重現(20–450 Hz 帶通雜訊加上爆發包絡,$f_s = 2000$ Hz),因為課程的 .mat 檔案不可轉散布。現象與你用 EMG_ICA.mat 會看到的完全相同。図 7-12 — 演習 3 の現象を、模擬した表面筋電様のバースト信号(20–450 Hz の帯域通過雑音にバースト包絡を掛けたもの、$f_s = 2000$ Hz)で再現したもの。授業で配られる .mat ファイルは再配布できないためである。現象は EMG_ICA.mat を使ったときに見えるものとまったく同じである。

(a) Up to 5000 Hz, back down to 2000 Hz — what happened?(a) 升到 5000 Hz 再降回 2000 Hz——發生了什麼事?(a) 5000 Hz まで上げ、2000 Hz へ戻す——何が起きたか

Essentially nothing: the curves overlay almost perfectly. Upsampling $2000 \to 5000$ ($P/Q = 5/2$) adds no information and loses none; coming back $5000 \to 2000$ ($P/Q = 2/5$) needs an anti-alias cutoff at 1000 Hz — but the signal never had content above its original Nyquist of 1000 Hz anyway. The only (tiny) differences are the transition-band edge effects of the two FIR anti-aliasing filters and small end transients.基本上什麼都沒發生:兩條曲線幾乎完全重疊。從 $2000 \to 5000$ 升取樣($P/Q = 5/2$)既不會增加資訊也不會失去資訊;再從 $5000 \to 2000$ 降回來($P/Q = 2/5$)需要在 1000 Hz 處做抗混疊截止——但訊號本來就沒有任何高於其原始 Nyquist 頻率 1000 Hz 的成分。唯一的(極小)差異來自兩個 FIR 抗混疊濾波器的過渡帶邊緣效應,以及頭尾的小暫態。升頻不丟資訊,降回原頻率時截止頻率剛好就是原本的 Nyquist,因此訊號幾乎完整復原。基本的には何も起きない。二つの曲線はほぼ完全に重なる。$2000 \to 5000$ のアップサンプリング($P/Q = 5/2$)は情報を増やしも減らしもしない。戻りの $5000 \to 2000$($P/Q = 2/5$)は 1000 Hz でのアンチエイリアス遮断を必要とするが、そもそも信号は元のナイキスト周波数 1000 Hz より上に中身をもっていない。(ごくわずかな)違いがあるとすれば、二つの FIR アンチエイリアスフィルタの遷移帯域端の効果と、両端の小さな過渡だけである。

(b) Down to 300 Hz, back up to 2000 Hz — what happened?(b) 降到 300 Hz 再升回 2000 Hz——發生了什麼事?(b) 300 Hz まで下げ、2000 Hz へ戻す——何が起きたか

The reconstruction is a smoothed, low-frequency caricature of the original. Going $2000 \to 300$ Hz forces an anti-aliasing lowpass at the new Nyquist, 150 Hz; the EMG's substantial energy from 150–450 Hz is permanently deleted. Upsampling back to 2000 Hz interpolates beautifully between the surviving samples but cannot re-create the destroyed band — the bursts lose their fast spikes and look rounded/blurred, with reduced amplitude.重建結果是原始訊號一個被平滑化、只剩低頻的漫畫版。從 2000 降到 300 Hz 時,抗混疊低通被迫設在新的 Nyquist 頻率 150 Hz;肌電訊號在 150–450 Hz 之間那一大塊能量被永久刪除。再升回 2000 Hz 時,內插在殘存的樣本之間做得再漂亮,也無法重建已經被毀掉的頻帶——爆發訊號失去了快速的尖峰,看起來變得圓鈍模糊,振幅也降低了。升取樣只能內插,不能無中生有。再構成されたものは、元の信号を平滑化して低域だけにした戯画である。$2000 \to 300$ Hz へ下げる際には、新しいナイキスト周波数 150 Hz でのアンチエイリアス低域通過が避けられず、筋電信号が 150–450 Hz にもつ相当量のエネルギーは永久に削除される。2000 Hz へ戻すアップサンプリングは、生き残った標本のあいだをみごとに補間するが、壊された帯域を作り直すことはできない——バーストは速いスパイクを失い、丸く滲んだ形になり、振幅も小さくなる。
Moral: down-then-up is lossy whenever the intermediate Nyquist is below the signal bandwidth; up-then-down (with the same start/end rates) is essentially lossless. Order of operations matters — this is the practical face of Section 7.4.啟示:只要中間那一段的 Nyquist 頻率低於訊號頻寬,先降後升就是有損的;而在起訖取樣率相同的前提下,先升後降基本上是無損的。運算順序很重要——這正是 7.4 節在實務上的面貌。教訓:途中のナイキスト周波数が信号帯域幅より低ければ、先に下げて後で上げる操作は損失を伴う。始点と終点のレートが同じであれば、先に上げて後で下げる操作は本質的に無損失である。演算の順序がものを言うのであり、これが 7.4 節の実務上の顔である。