Outline大綱アウトライン
2.1 Discrete-Time Systems2.1 離散時間系統2.1 離散時間システム
2.2 Classes of DT Systems2.2 離散時間系統的分類2.2 離散時間システムの分類
2.3 LTI Systems & Impulse Response2.3 LTI 系統與脈衝響應2.3 LTI システムとインパルス応答
2.4 The Convolution Sum2.4 卷積和2.4 畳み込み和
2.5 LTI Properties via h[n]2.5 由 h[n] 判讀 LTI 性質2.5 h[n] から見た LTI の性質
2.6 Summary2.6 本章總結2.6 まとめ
Exercises習題演習問題
DSP Study Guide · Chapter 2
DSP 學習指南 · 第 2 章
DSP 学習ガイド · 第 2 章

Discrete-Time Systems (I)離散時間系統(一)離散時間システム(I)

System properties (linearity, time invariance, causality, stability), LTI systems, the impulse response, the convolution sum, and system interconnections
系統性質(線性、非時變、因果性、穩定性)、LTI 系統、脈衝響應、卷積和,以及系統的互連
システムの性質(線形性・時不変性・因果性・安定性)、LTI システム、インパルス応答、畳み込み和、そしてシステムの相互接続

2.1 Discrete-Time Systems2.1 離散時間系統2.1 離散時間システム

2.1.1 The system operator2.1.1 系統運算子2.1.1 システム作用素

A discrete-time system(離散時間系統) is a transformation $T\{\cdot\}$ that maps an input sequence $x[n]$ into an output sequence $y[n]$:

離散時間系統(discrete-time system)是一個轉換 $T\{\cdot\}$,把輸入序列 $x[n]$ 映射成輸出序列 $y[n]$:

離散時間システム(離散時間系統)とは、入力系列 $x[n]$ を出力系列 $y[n]$ へ写す変換 $T\{\cdot\}$ のことである:

DT System 離散時間系統離散時間システム $$y[n] = T\{x[n]\}$$

The operator $T$ may act on the entire input sequence: in general, the output sample $y[n]$ at one time index can depend on input samples $x[k]$ at all indices $k$ — past, present, and future. Everything in this chapter is about classifying systems by which samples they use and how they combine them.

運算子 $T$ 可以作用在整條輸入序列上:一般而言,某一時刻的輸出樣本 $y[n]$ 可以同時取決於所有索引 $k$ 的輸入樣本 $x[k]$——過去、現在與未來都算。本章自始至終都在做一件事:依照系統「用了哪些樣本」以及「如何把它們組合起來」來分類系統。

作用素 $T$ は入力系列全体に作用してよい。一般に、ある時刻の出力標本 $y[n]$ は、あらゆるインデックス $k$ における入力標本 $x[k]$——過去・現在・未来——に依存しうる。本章の内容はすべて、システムがどの標本を使い、それらをどのように組み合わせるかによってシステムを分類することに尽きる。

Why classify systems?
為什麼要把系統分類?
なぜシステムを分類するのか
Most of DSP theory (frequency response, $z$-transform analysis, filter design) applies only to the special class of linear time-invariant(線性非時變) systems. The first job when you meet a new system is to test its properties — that decides which analysis tools you may use.DSP 理論的絕大部分(頻率響應、$z$ 轉換分析、濾波器設計)只適用於線性非時變(linear time-invariant)這個特殊的系統類別。遇到一個新系統時,第一件事就是檢驗它的性質——那決定了你可以動用哪些分析工具。DSP の理論の大半(周波数応答、$z$ 変換による解析、フィルタ設計)は、線形時不変(線性非時變)という特別なクラスのシステムにしか適用できない。新しいシステムに出会ったとき最初にすべき仕事は、その性質を調べることである。それによって、どの解析道具を使ってよいかが決まる。

2.1.2 Example: moving average (MA)2.1.2 範例:移動平均(MA)2.1.2 例:移動平均(MA)

The moving average(移動平均) system computes, for each $n$, the average of the input over a sliding window. The general (possibly non-causal) form averages $M_1$ future and $M_2$ past samples:

移動平均(moving average,MA)系統對每個 $n$ 計算輸入在一個滑動窗口內的平均值。一般(可能非因果)的形式對 $M_1$ 個未來樣本與 $M_2$ 個過去樣本取平均:

移動平均(移動平均)システムは、各 $n$ について、滑る窓の中での入力の平均を計算する。一般形(因果的でない場合もある)は、未来の $M_1$ 標本と過去の $M_2$ 標本を平均する:

Moving Average 移動平均移動平均 $$y[n] = \frac{1}{M_1+M_2+1}\sum_{k=-M_1}^{M_2} x[n-k]$$

The common causal $M$-point moving average uses only the present and past $M-1$ samples:

常見的因果 $M$ 點移動平均只用到現在與過去的 $M-1$ 個樣本:

よく使われる因果的な $M$ 点移動平均は、現在と過去の $M-1$ 標本だけを用いる:

Causal M-point MA 因果 M 點移動平均因果的な M 点移動平均 $$y[n] = \frac{1}{M}\sum_{k=0}^{M-1} x[n-k]$$

The MA is the simplest smoother(平滑器): averaging adjacent samples cancels rapid, zero-mean fluctuations (noise) while approximately preserving slow trends. Fig. 2-1 shows a noisy sequence and the output of a 5-point MA.

移動平均是最簡單的平滑器(smoother):把相鄰樣本平均掉,可以抵消快速、零均值的起伏(雜訊),同時大致保留緩慢的趨勢。圖 2-1 顯示一條含雜訊的序列與 5 點移動平均的輸出。

移動平均は最も単純な平滑化器(平滑器)である。隣接する標本を平均すると、速くて平均ゼロの変動(雑音)が打ち消される一方、ゆっくりした傾向はおおむね保たれる。図 2-1 に、雑音を含む系列と 5 点移動平均の出力を示す。

移動平均到底在做什麼?(為何能去雜訊、代價是什麼)(點擊展開)
它取的是「現在這一筆 + 前面 $M-1$ 筆」共 $M$ 筆的平均,當作時刻 $n$ 的輸出: $$y[n]=\tfrac1M\big(x[n]+x[n-1]+\cdots+x[n-M+1]\big).$$ 注意 $k=0$ 就是現在 $x[n]$,不是只有過去;因為完全沒用到 $x[n+1]$ 等未來 ⇒ 因果。 例($M=3$):$y[n]=\tfrac13\big(x[n]+x[n-1]+x[n-2]\big)$。

為什麼平均能去雜訊:把訊號看成「真實值 + 零均值雜訊」。相鄰幾筆的真實值差不多, 平均後幾乎不變;雜訊有正有負,平均後彼此抵消。理論上 $M$ 筆獨立、變異數 $\sigma^2$ 的雜訊,平均後變異數降為 $\sigma^2/M$(雜訊強度約降 $\sqrt{M}$ 倍)。所以它是最簡單的低通/平滑濾波器。

代價有兩個:
  • 延遲:窗口只朝過去看,輸出重心落在 $n-\tfrac{M-1}{2}$,結果比真實訊號慢約 $\tfrac{M-1}{2}$ 拍(Fig. 2-1 可見)。
  • 變鈍:$M$ 越大越平滑、雜訊壓得越乾淨,但邊緣、尖峰等快速變化也被抹平。要在「去雜訊」與「保留細節」之間取捨。
想消除延遲?改用置中平均(同時取前後幾筆,如 $\tfrac13(x[n-1]+x[n]+x[n+1])$), 重心對齊 $n$、無延遲——但用到未來樣本 ⇒ 非因果,只能離線處理(見 §2.2.4 因果性)。
2026-06-12T22:22:27.316490 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 2 4 6 x[n] Noisy input x[n] = s[n] + noise underlying trend s[n] 0 10 20 30 40 50 60 n 0 1 2 3 4 5 y[n] 5-point moving-average output (noise reduced, slight delay)
Fig. 2-1 — A noisy sequence (top) and the output of a causal 5-point moving average (bottom). The averaging suppresses the zero-mean noise while tracking the slow trend, at the cost of a small delay(移動平均抑制雜訊,但引入少量延遲).
圖 2-1 — 上:含雜訊的序列;下:因果 5 點移動平均的輸出。平均把零均值雜訊壓了下來、又能跟上緩慢的趨勢,代價是一點點延遲。
図 2-1 — 雑音を含む系列(上)と、因果的な 5 点移動平均の出力(下)。平均化によって平均ゼロの雑音が抑えられ、ゆっくりした傾向は追従できているが、その代償としてわずかな遅延が生じる(移動平均抑制雜訊,但引入少量延遲)。
Tip — MA is an FIR filter
小技巧 — 移動平均就是一個 FIR 濾波器
ヒント — 移動平均は FIR フィルタである
The $M$-point moving average is a finite impulse response (FIR) filter with impulse response $h[n] = 1/M$ for $0 \le n \le M-1$ (see §2.3.2). In MATLAB: y = conv(x, ones(1,M)/M). Larger $M$ means stronger smoothing but more delay and more blurring of fast features.$M$ 點移動平均是一個有限脈衝響應(FIR)濾波器,其脈衝響應為 $0 \le n \le M-1$ 時 $h[n] = 1/M$(見 §2.3.2)。在 MATLAB 裡:y = conv(x, ones(1,M)/M)。$M$ 愈大,平滑效果愈強,但延遲也愈大、快速變化被抹得愈糊。$M$ 点移動平均は、インパルス応答が $0 \le n \le M-1$ で $h[n] = 1/M$ となる有限インパルス応答(FIR)フィルタである(§2.3.2 を参照)。MATLAB では y = conv(x, ones(1,M)/M)。$M$ を大きくすると平滑化は強くなるが、遅延が増え、速い特徴もぼやけてしまう。

2.1.3 Example: accumulator2.1.3 範例:累加器2.1.3 例:累算器

The accumulator(累加器) sums all input samples up to the present time — the discrete-time analogue of an integrator:

累加器(accumulator)把到目前時刻為止的所有輸入樣本加起來——它是積分器的離散時間對應物:

累算器(累加器)は現在時刻までの入力標本をすべて足し合わせる——積分器の離散時間版である:

Accumulator 累加器累算器 $$y[n] = \sum_{k=-\infty}^{n} x[k]$$

Splitting off the newest term gives the equivalent recursive(遞迴) form, which is how you would actually implement it:

把最新的一項單獨拆出來,就得到等價的遞迴(recursive)形式,實作上實際會這樣寫:

最も新しい項を切り離すと、等価な再帰(遞迴)形が得られる。実際に実装するときはこちらを使う:

Recursive Form 遞迴形式再帰形 $$y[n] = y[n-1] + x[n]$$

For example, with input $x[n]=n\,u[n]$ the output is $y[n] = \sum_{k=0}^{n} k = \frac{n(n+1)}{2}\,u[n]$ — the running sum grows like $n^2$. The accumulator will reappear twice in this chapter: as a system that is linear, time-invariant, causal but unstable (§2.2.5), and as the classic example of an invertible system (§2.5.4).

舉例來說,輸入 $x[n]=n\,u[n]$ 時輸出為 $y[n] = \sum_{k=0}^{n} k = \frac{n(n+1)}{2}\,u[n]$——這個連續和以 $n^2$ 的速度成長。累加器在本章會再出現兩次:一次是當作線性、非時變、因果但不穩定的系統(§2.2.5),另一次是當作可逆系統的經典例子(§2.5.4)。

たとえば入力 $x[n]=n\,u[n]$ に対する出力は $y[n] = \sum_{k=0}^{n} k = \frac{n(n+1)}{2}\,u[n]$ となり、累和は $n^2$ のように増大する。累算器は本章で 2 度再登場する。線形・時不変・因果的でありながら不安定なシステムの例として(§2.2.5)、そして可逆なシステムの典型例として(§2.5.4)である。

2.2 Classes of Discrete-Time Systems2.2 離散時間系統的分類2.2 離散時間システムの分類

Five properties are tested over and over in this course. For each one you should know the formal definition, a standard example, and a standard counterexample.

這門課會反覆檢驗五個性質。對每一個性質,你都應該記得它的正式定義、一個標準例子,以及一個標準反例。

この授業では 5 つの性質を繰り返し調べることになる。それぞれについて、形式的な定義、代表的な例、そして代表的な反例を押さえておくこと。

2.2.1 Memoryless systems2.2.1 無記憶系統2.2.1 無記憶システム

A system is memoryless(無記憶) if $y[n]$ depends only on $x[n]$ at the same index $n$. Example: $y[n]=\left(x[n]\right)^2$. Counterexample: the MA and the accumulator both use past samples, so they have memory.

一個系統是無記憶(memoryless)的,如果 $y[n]$ 只取決於同一個索引 $n$ 上的 $x[n]$。例:$y[n]=\left(x[n]\right)^2$。反例:移動平均與累加器都用到過去的樣本,所以它們有記憶。

システムが無記憶(無記憶)であるとは、$y[n]$ が同じインデックス $n$ の $x[n]$ だけに依存することをいう。例:$y[n]=\left(x[n]\right)^2$。反例:移動平均も累算器も過去の標本を使うので、記憶をもつ。

2.2.2 Linearity2.2.2 線性2.2.2 線形性

A system $T$ is linear(線性) if it satisfies superposition: for all signals $x_1, x_2$ and all constants $a, b$,

系統 $T$ 是線性(linear)的,如果它滿足疊加原理:對所有訊號 $x_1, x_2$ 與所有常數 $a, b$,

システム $T$ が線形(線性)であるとは、重ね合わせを満たすことをいう。すなわち、すべての信号 $x_1, x_2$ とすべての定数 $a, b$ について、

Linearity (Superposition) 線性(疊加原理)線形性(重ね合わせ) $$T\{a\,x_1[n] + b\,x_2[n]\} = a\,T\{x_1[n]\} + b\,T\{x_2[n]\}$$

Superposition combines two requirements: additivity(可加性) $T\{x_1+x_2\}=T\{x_1\}+T\{x_2\}$ and homogeneity / scaling(齊次性) $T\{a\,x\}=a\,T\{x\}$. Three slide examples:

疊加原理同時包含兩個要求:可加性(additivity)$T\{x_1+x_2\}=T\{x_1\}+T\{x_2\}$,以及齊次性/比例性(homogeneity / scaling)$T\{a\,x\}=a\,T\{x\}$。課堂上的三個例子:

重ね合わせは 2 つの要件を合わせたものである:加法性(可加性) $T\{x_1+x_2\}=T\{x_1\}+T\{x_2\}$ と、斉次性・スケーリング(齊次性) $T\{a\,x\}=a\,T\{x\}$ である。スライドにあった 3 つの例を見てみよう:

Example 2.1 — Three linearity tests範例 2.1 —— 三個線性判別例 2.1 — 線形性の 3 つの判定
(1) Accumulator $y[n]=\sum_{k\le n}x[k]$ — linear. $\sum_{k\le n}\bigl(a x_1[k]+b x_2[k]\bigr) = a\sum_{k\le n}x_1[k] + b\sum_{k\le n}x_2[k]$. Sums distribute over scaled inputs, so superposition holds exactly.
(1) 累加器 $y[n]=\sum_{k\le n}x[k]$ —— 線性。 $\sum_{k\le n}\bigl(a x_1[k]+b x_2[k]\bigr) = a\sum_{k\le n}x_1[k] + b\sum_{k\le n}x_2[k]$。 求和對加權輸入具有分配性,所以疊加原理嚴格成立。
(1) 累算器 $y[n]=\sum_{k\le n}x[k]$——線形。$\sum_{k\le n}\bigl(a x_1[k]+b x_2[k]\bigr) = a\sum_{k\le n}x_1[k] + b\sum_{k\le n}x_2[k]$。和はスケールされた入力に対して分配されるので、重ね合わせは厳密に成り立つ。
(2) Squarer $y[n]=\left(x[n]\right)^2$ — nonlinear. Scaling test: input $a\,x[n]$ produces $a^2 x^2[n] \ne a\,x^2[n]$ for general $a$. One failed test is enough.
(2) 平方器 $y[n]=\left(x[n]\right)^2$ —— 非線性。 比例性測試:輸入 $a\,x[n]$ 會得到 $a^2 x^2[n] \ne a\,x^2[n]$(對一般的 $a$)。 只要一項測試不過就足以判定非線性。
(2) 二乗器 $y[n]=\left(x[n]\right)^2$——非線形。スケーリングの判定:入力 $a\,x[n]$ を与えると、一般の $a$ に対して $a^2 x^2[n] \ne a\,x^2[n]$ となる。判定に 1 つでも失敗すれば十分である。
(3) Affine system $y[n]=c\,x[n]+d$ ($d\neq0$) — nonlinear. Zero input gives $y[n]=d\neq 0$. A linear system must map the zero signal to the zero signal (set $a=b=0$ in the definition). A line that misses the origin is affine, not linear.
(3) 仿射系統 $y[n]=c\,x[n]+d$($d\neq0$)—— 非線性。 零輸入會得到 $y[n]=d\neq 0$。線性系統必須把零訊號映射到零訊號(在定義中令 $a=b=0$ 即可看出)。 一條不通過原點的直線是仿射(affine),而不是線性。
(3) アフィンなシステム $y[n]=c\,x[n]+d$($d\neq0$)——非線形。入力をゼロにすると $y[n]=d\neq 0$ となる。線形システムはゼロ信号をゼロ信号へ写さなければならない(定義で $a=b=0$ とおけばよい)。原点を通らない直線はアフィンであって線形ではない。
「再加一維」能把非線性變線性嗎?(齊次座標 vs 核技巧;3D 影像為何這樣做)(點擊展開)
要分兩種「非線性」來看。

1. 仿射(只差一個常數偏移 $+d$)——加一維「精確」變線性。 這就是電腦圖學的齊次座標(homogeneous coordinates)。$y=cx+d$ 對 $x$ 因為有 $+d$ 不是線性, 但把輸入墊高一維、補一個常數 1: $$\tilde{x}=\begin{bmatrix}x\\ 1\end{bmatrix},\qquad y=\begin{bmatrix}c & d\end{bmatrix}\begin{bmatrix}x\\ 1\end{bmatrix}=cx+d.$$ 現在 $y$ 對「擴增向量 $\tilde x$」是純線性(矩陣乘法、過原點),偏移 $d$ 被藏進矩陣裡。

3D 影像/圖學的確標準這樣做:
  • 3D 點 $(x,y,z)$ 寫成 4 維齊次座標 $(x,y,z,1)$。
  • 旋轉、縮放(本來就線性)+平移(本來是仿射)合併成單一 $4\times4$ 矩陣,整串變換變成矩陣連乘,GPU 一次算完。
  • 透視投影也靠最後那一維($w$ 分量)的除法來實現。

2. 真正的非線性($y=x^2$、$\sin$、乘法 $x_1x_2$)——補一個常數維度救不了。 但「升維」的精神仍有用,只是要升到特徵空間: $$x\ \longmapsto\ \phi(x)=\big(x,\;x^2\big)\quad\Rightarrow\quad y=x^2\text{ 對 }\phi(x)\text{ 的第二維是線性的}.$$ 這就是機器學習的核技巧(kernel trick)/特徵映射:把資料映到更高(甚至無限)維,讓非線性問題在高維變線性可分;代價是維度可能爆炸。

一句話:仿射(差常數偏移)⇒ 補 1 維齊次座標就精確變線性(3D 圖學標準手法); 真非線性($x^2$ 等)⇒ 要升到特徵/核空間,不是補一維就好。本章這個仿射反例,正是「為什麼要用齊次座標」的起點。
Warning — the zero-input shortcut
注意 — 「零輸入」捷徑
注意 — ゼロ入力による近道
If $x[n]=0$ for all $n$ does not produce $y[n]=0$ for all $n$, the system is not linear — no further work needed. But the converse fails: zero-in/zero-out does NOT prove linearity (e.g. $y[n]=x^2[n]$ passes the zero test yet is nonlinear). To prove linearity you must verify superposition for arbitrary $a, b, x_1, x_2$.若對所有 $n$ 都有 $x[n]=0$ 卻沒有對所有 $n$ 得到 $y[n]=0$,那麼這個系統不是線性的——不必再做任何事。但反過來不成立:零輸入給出零輸出並不能證明線性(例如 $y[n]=x^2[n]$ 通過了零輸入測試,卻仍是非線性的)。要證明線性,必須對任意的 $a, b, x_1, x_2$ 驗證疊加原理。すべての $n$ で $x[n]=0$ としたときに、すべての $n$ で $y[n]=0$ とならないなら、そのシステムは線形ではない——それ以上調べる必要はない。しかし逆は成り立たない。ゼロ入力でゼロ出力だからといって線形性が示されるわけではない(たとえば $y[n]=x^2[n]$ はこの判定を通るが非線形である)。線形性を証明するには、任意の $a, b, x_1, x_2$ について重ね合わせを確かめなければならない。

2.2.3 Time (shift) invariance2.2.3 時間(平移)不變性2.2.3 時不変性(シフト不変性)

A system is time-invariant(非時變), also called shift-invariant, if delaying the input only delays the output by the same amount — the system's behaviour does not change with time:

一個系統是非時變(time-invariant)的,也叫平移不變(shift-invariant),如果把輸入延遲,輸出也只是延遲同樣多——系統的行為不隨時間改變:

システムが時不変(非時變)である(シフト不変ともいう)とは、入力を遅らせると出力も同じだけ遅れるだけで、システムの振る舞いが時間とともに変わらないことをいう:

Time Invariance 非時變性時不変性 $$\text{if } y[n] = T\{x[n]\},\ \text{then}\quad T\{x[n-n_0]\} = y[n-n_0] \quad \text{for every integer } n_0$$

How to test: (i) shift the input first, push it through the system to get $w[n]=T\{x[n-n_0]\}$; (ii) shift the original output to get $y[n-n_0]$; (iii) compare. They must agree for every $x$ and every $n_0$.

怎麼測:(i) 先把輸入平移,再送進系統得到 $w[n]=T\{x[n-n_0]\}$;(ii) 把原本的輸出平移得到 $y[n-n_0]$;(iii) 比較兩者。它們必須對每一個 $x$ 與每一個 $n_0$ 都相等。

判定の仕方:(i) まず入力をシフトしてからシステムに通し、$w[n]=T\{x[n-n_0]\}$ を得る。(ii) もとの出力をシフトして $y[n-n_0]$ を得る。(iii) 両者を比較する。すべての $x$ とすべての $n_0$ について一致しなければならない。

Example 2.2 — Two shift-invariance counterexamples範例 2.2 —— 兩個違反平移不變性的反例例 2.2 — シフト不変でない 2 つの反例
(1) Compressor (down-sampler) $y[n]=x[Mn]$, $M\ge 2$ — time-varying. Shifted input: $w[n] = x[Mn-n_0]$. Shifted output: $y[n-n_0] = x[M(n-n_0)] = x[Mn - Mn_0]$. Since $Mn_0 \neq n_0$ for $M \ge 2$, $w[n] \neq y[n-n_0]$ in general. Intuition: the compressor re-labels the time axis, so "when a sample happens" matters.
(1) 壓縮器(降取樣器)$y[n]=x[Mn]$、$M\ge 2$ —— 時變。 平移後的輸入:$w[n] = x[Mn-n_0]$。平移後的輸出:$y[n-n_0] = x[M(n-n_0)] = x[Mn - Mn_0]$。 因為 $M \ge 2$ 時 $Mn_0 \neq n_0$,一般而言 $w[n] \neq y[n-n_0]$。直觀理解:壓縮器把時間軸重新標號,所以「樣本發生在什麼時刻」是有差別的。
(1) 圧縮器(ダウンサンプラ)$y[n]=x[Mn]$、$M\ge 2$——時変。シフトした入力:$w[n] = x[Mn-n_0]$。シフトした出力:$y[n-n_0] = x[M(n-n_0)] = x[Mn - Mn_0]$。$M \ge 2$ では $Mn_0 \neq n_0$ なので、一般に $w[n] \neq y[n-n_0]$ である。直観的には、圧縮器は時間軸に付け直したラベルを変えてしまうので、「標本がいつ起きたか」が効いてくる。
(2) Time-weighted gain $y[n]=n\,x[n]$ — time-varying. Shifted input: $w[n]=n\,x[n-n_0]$. Shifted output: $y[n-n_0]=(n-n_0)\,x[n-n_0]$. These differ by $n_0\,x[n-n_0]$. The gain applied to a sample depends on the clock, not just the sample.
(2) 時間加權增益 $y[n]=n\,x[n]$ —— 時變。 平移後的輸入:$w[n]=n\,x[n-n_0]$。平移後的輸出:$y[n-n_0]=(n-n_0)\,x[n-n_0]$。兩者差了 $n_0\,x[n-n_0]$。施加在某個樣本上的增益取決於時鐘,而不只是樣本本身。
(2) 時間に依存する利得 $y[n]=n\,x[n]$——時変。シフトした入力:$w[n]=n\,x[n-n_0]$。シフトした出力:$y[n-n_0]=(n-n_0)\,x[n-n_0]$。両者は $n_0\,x[n-n_0]$ だけ食い違う。標本にかかる利得が、標本そのものではなく時計に依存しているからである。
直觀解釋(點擊展開)
線性:把輸入「加倍」,輸出也恰好加倍;兩個輸入疊加,輸出就是各自輸出的疊加。 判斷時最快的第一步是代入全零輸入——若輸出不是零,必為非線性(例如 $y[n]=cx[n]+d$,$d\neq0$)。 非時變:系統像一台「不會變心」的機器——今天丟進去與明天丟進去同樣的訊號, 得到的回應形狀完全相同,只是時間平移。測試口訣:「先移再過系統」與「先過系統再移」結果必須一樣。 凡是規則裡明確出現 $n$(如 $y[n]=n\,x[n]$)或改變時間軸刻度(如 $x[2n]$、$x[an-b]$ 中 $a\neq1$)的系統, 幾乎都會破壞非時變性。

2.2.4 Causality2.2.4 因果性2.2.4 因果性

A system is causal(因果) if $y[n_0]$ depends only on input samples $x[n]$ with $n \le n_0$ — present and past, never the future. Causality is mandatory for real-time processing; offline (stored-data) processing can afford non-causal systems.

一個系統是因果(causal)的,如果 $y[n_0]$ 只取決於 $n \le n_0$ 的輸入樣本 $x[n]$——現在與過去,絕不用到未來。即時處理一定要求因果;離線(資料已存好)處理則可以使用非因果系統。

システムが因果的(因果)であるとは、$y[n_0]$ が $n \le n_0$ なる入力標本 $x[n]$ だけに依存すること、すなわち現在と過去だけを使い、未来を決して使わないことをいう。実時間処理では因果性は必須である。オフライン(蓄積データ)の処理であれば、非因果的なシステムも許される。

Example 2.3 — Forward vs. backward difference範例 2.3 —— 前向差分與後向差分例 2.3 — 前進差分と後退差分
Forward difference $y[n] = x[n+1]-x[n]$: needs the future sample $x[n+1]$ → non-causal.
前向差分 $y[n] = x[n+1]-x[n]$:需要未來樣本 $x[n+1]$ → 非因果。
前進差分 $y[n] = x[n+1]-x[n]$:未来の標本 $x[n+1]$ が必要 → 非因果的。
Backward difference $y[n] = x[n]-x[n-1]$: uses only present and past → causal.
後向差分 $y[n] = x[n]-x[n-1]$:只用到現在與過去 → 因果。
後退差分 $y[n] = x[n]-x[n-1]$:現在と過去だけを使う → 因果的。
Likewise the centered MA ($M_1>0$ in §2.1.2) is non-causal, while the $M$-point causal MA is causal. A non-causal FIR system can always be made causal by adding enough delay.
同樣地,置中的移動平均(§2.1.2 中 $M_1>0$ 的情形)是非因果的,而 $M$ 點因果移動平均是因果的。任何非因果的 FIR 系統,只要加上足夠的延遲,都可以變成因果系統。
同様に、中心化された移動平均(§2.1.2 で $M_1>0$ の場合)は非因果的であり、$M$ 点の因果的移動平均は因果的である。非因果的な FIR システムは、十分な遅延を加えれば必ず因果的にできる。
系統的輸出可以包含「未來」輸入項嗎?(點擊展開)
數學上可以。系統定義 $y[n]=T\{x[n]\}$ 並沒有限制只能用過去的輸入。像 $y[n]=x[n+1]$、$y[n]=\tfrac12\big(x[n-1]+x[n+1]\big)$ 都用到未來樣本 $x[n+1]$, 這類系統稱為非因果(non-causal)。

因果系統則規定 $y[n_0]$ 只能依賴 $x[n],\,n\le n_0$(現在與過去)。 判別法:若兩輸入在 $n\le n_0$ 完全相同 ⇒ 輸出 $y[n_0]$ 必相同;只要找得到一個用到 $n>n_0$ 的反例,就是非因果。

能不能「實作」用未來項,要看場景:
  • 即時/串流(麥克風、通訊):未來樣本還沒發生,只能因果。
  • 離線/批次(整段音檔、影像已存好):整條序列都在記憶體裡,$x[n+1]$ 隨手可取,非因果照樣能跑。
所以「未來」是相對於目前處理的索引 $n$;資料若已錄好,非因果濾波器並非不可實現。

工程折衷——用延遲換因果:想要非因果的理想響應(例如零相位濾波器)時, 可先暫存幾筆樣本、晚一點再輸出,把「等待」換成「看到未來」。 例如 $y[n]=x[n+1]-x[n]$(非因)整體延遲 1 拍後變成 $y'[n]=y[n-1]=x[n]-x[n-1]$,就成了因果的後向差分。 這也是「A non-causal FIR system can always be made causal by adding enough delay」那句話的意思。

通則(延遲 $L$ 公式):任何 FIR 系統都能寫成有限加權和 $$y[n]=\sum_{k=-L}^{K} b_k\,x[n-k],$$ 其中 $k<0$ 的項就是未來樣本($x[n+1],\dots,x[n+L]$),最遠的未來樣本是 $x[n+L]$(即 $k=-L$)。 把整條輸出延遲這個最大未來步數 $L$: $$y'[n]=y[n-L]=\sum_{k=-L}^{K} b_k\,x[n-L-k] \;\overset{\,m=k+L\,}{=}\;\sum_{m=0}^{K+L} b_{m-L}\,x[n-m].$$ 換完變數後求和只剩 $m\ge0$,即只用到 $x[n],x[n-1],\dots$(現在與過去)⇒ 因果。 最遠的未來項 $x[n+L]$ 正好被推到 $x[n]$(現在)。

數值例(置中 3 點平均,$L=1$): $$y[n]=\tfrac13\big(x[n-1]+x[n]+x[n+1]\big)\quad(\text{非因,最遠用到 }x[n+1])$$ $$\xrightarrow{\text{延遲 }1}\quad y'[n]=y[n-1]=\tfrac13\big(x[n-2]+x[n-1]+x[n]\big)\quad(\text{因果}).$$ 脈衝響應的形狀完全沒變,只是整條輸出晚 $L$ 拍出來——用「等待」換「看到未來」。
前提是 FIR($L$ 有限);若 IIR 用到無上限的未來項($x[n+1],x[n+2],\dots$),找不到有限的 $L$,就無法靠延遲補救。

2.2.5 BIBO stability2.2.5 BIBO 穩定性2.2.5 BIBO 安定性

A system is BIBO stable(有界輸入有界輸出穩定) if every bounded input produces a bounded output:

一個系統是BIBO 穩定(bounded-input bounded-output,有界輸入有界輸出)的,如果每一個有界輸入都產生有界輸出:

システムがBIBO 安定(有界輸入有界輸出穩定)であるとは、有界な入力がすべて有界な出力を生むことをいう:

BIBO Stability BIBO 穩定性BIBO 安定性 $$|x[n]| \le B_x < \infty \ \ \forall n \quad \Longrightarrow \quad |y[n]| \le B_y < \infty \ \ \forall n$$

To prove instability you only need one bounded input whose output blows up. The classic victim is the accumulator: feed it the bounded step $x[n]=u[n]$ and the output is the unbounded ramp $y[n]=(n+1)u[n]$ — see Fig. 2-4.

要證明不穩定,只需要找到一個有界輸入使輸出發散。最經典的受害者是累加器:餵給它有界的步階 $x[n]=u[n]$,輸出就是無界的斜坡 $y[n]=(n+1)u[n]$——見圖 2-4。

不安定であることを示すには、出力が発散するような有界入力を1 つ見つければよい。典型的な犠牲者は累算器である。有界なステップ $x[n]=u[n]$ を入れると、出力は有界でないランプ $y[n]=(n+1)u[n]$ になる——図 2-4 を参照。

2026-06-12T22:22:27.878405 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0.0 0.5 1.0 x[n] = u[n] Bounded input: unit step −5.0 −2.5 0.0 2.5 5.0 7.5 10.0 12.5 n 0 5 10 y[n] = (n+1)u[n] Accumulator output grows without bound → not BIBO stable
Fig. 2-4 — The accumulator driven by the bounded unit step produces the unbounded ramp y[n]=(n+1)u[n]: one bounded input with an unbounded output proves the accumulator is not BIBO stable.
圖 2-4 — 用有界的單位步階驅動累加器,輸出是無界的斜坡 $y[n]=(n+1)u[n]$:一個有界輸入卻得到無界輸出,就足以證明累加器不是 BIBO 穩定。
図 2-4 — 有界な単位ステップで駆動した累算器は、有界でないランプ y[n]=(n+1)u[n] を生む。有界な入力が 1 つでも有界でない出力を与えれば、累算器が BIBO 安定でないことの証明になる。
★ Important — System properties at a glance(重要:系統性質總表)★ 重點 —— 系統性質總表★ 重要 — システムの性質ひとめ表(重要:系統性質總表)
SystemMemorylessLinearTime-inv.CausalStable
Ideal delay $y[n]=x[n-n_d]$, $n_d>0$NoYesYesYesYes
Causal $M$-point MANoYesYesYesYes
Centered MA ($M_1>0$)NoYesYesNoYes
AccumulatorNoYesYesYesNo
Compressor $y[n]=x[Mn]$NoYesNoNoYes
$y[n]=n\,x[n]$YesYesNoYesNo
Squarer $y[n]=x^2[n]$YesNoYesYesYes
系統無記憶線性非時變因果穩定
理想延遲 $y[n]=x[n-n_d]$、$n_d>0$否是是是是
因果 $M$ 點移動平均否是是是是
置中移動平均($M_1>0$)否是是否是
累加器否是是是否
壓縮器 $y[n]=x[Mn]$否是否否是
$y[n]=n\,x[n]$是是否是否
平方器 $y[n]=x^2[n]$是否是是是
システム無記憶線形時不変因果的安定
理想遅延 $y[n]=x[n-n_d]$、$n_d>0$いいえはいはいはいはい
因果的な $M$ 点移動平均いいえはいはいはいはい
中心化移動平均($M_1>0$)いいえはいはいいいえはい
累算器いいえはいはいはいいいえ
圧縮器 $y[n]=x[Mn]$いいえはいいいえいいえはい
$y[n]=n\,x[n]$はいはいいいえはいいいえ
二乗器 $y[n]=x^2[n]$はいいいえはいはいはい

2.3 LTI Systems and the Impulse Response2.3 LTI 系統與脈衝響應2.3 LTI システムとインパルス応答

2.3.1 From the sifting property to convolution2.3.1 從篩選性質到卷積2.3.1 ふるい分けの性質から畳み込みへ

A system that is both linear and time-invariant is called LTI(線性非時變) — the slides also use the equivalent name LSI (linear shift-invariant). For LTI systems one single signal characterizes the system completely: the impulse response(脈衝響應)

同時具備線性與非時變的系統稱為 LTI(linear time-invariant,線性非時變)——課堂投影片也用等價的名稱 LSI(linear shift-invariant,線性平移不變)。對 LTI 系統而言,只要一個訊號就能完整刻畫整個系統:脈衝響應(impulse response)

線形かつ時不変であるシステムを LTI(線性非時變) という——スライドでは同義語として LSI(線形シフト不変)も使われている。LTI システムでは、たった 1 つの信号がシステムを完全に特徴づける。それがインパルス応答(脈衝響應)である

Impulse Response 脈衝響應インパルス応答 $$h[n] \;=\; T\{\delta[n]\}$$

The derivation is the most important three lines of the course. Start from the sifting decomposition of Chapter 1 — any sequence is a weighted sum of shifted impulses:

接下來的推導是這門課最重要的三行。從第 1 章的篩選分解出發——任何序列都是位移脈衝的加權和:

この導出は、この授業で最も重要な 3 行である。第 1 章のふるい分けによる分解から始める。任意の系列は、シフトされたインパルスの重み付き和であった:

Sifting Property 篩選性質ふるい分けの性質 $$x[n] = \sum_{k=-\infty}^{\infty} x[k]\,\delta[n-k]$$

Apply $T$ and use linearity (the $x[k]$ are just constants) and then time invariance ($\delta[n-k] \mapsto h[n-k]$):

把 $T$ 作用上去,先用線性($x[k]$ 只是常數),再用非時變性($\delta[n-k] \mapsto h[n-k]$):

ここに $T$ を作用させ、線形性($x[k]$ はただの定数である)を使い、次に時不変性($\delta[n-k] \mapsto h[n-k]$)を使う:

Convolution Sum Derivation 卷積和的推導畳み込み和の導出 $$y[n] = T\Bigl\{\sum_{k=-\infty}^{\infty} x[k]\,\delta[n-k]\Bigr\} \;\overset{\text{lin.}}{=}\; \sum_{k=-\infty}^{\infty} x[k]\,T\{\delta[n-k]\} \;\overset{\text{T.I.}}{=}\; \sum_{k=-\infty}^{\infty} x[k]\,h[n-k]$$
Key — h[n] tells you everything
重點 — h[n] 說明了一切
要点 — h[n] がすべてを語る
For an LTI system, knowing $h[n]$ means knowing the output for every input: $y[n] = x[n] * h[n]$. All later analysis (frequency response, transfer function) is just different ways of looking at $h[n]$. This is exactly why we care so much about the LTI class.對 LTI 系統而言,知道 $h[n]$ 就等於知道每一個輸入對應的輸出:$y[n] = x[n] * h[n]$。後面所有的分析(頻率響應、轉移函數)都只是用不同方式來看 $h[n]$ 而已。這正是我們如此在意 LTI 這個類別的原因。LTI システムでは、$h[n]$ を知ることはあらゆる入力に対する出力を知ることに等しい:$y[n] = x[n] * h[n]$。以降の解析(周波数応答、伝達関数)はすべて、$h[n]$ を別の角度から眺めているにすぎない。私たちが LTI というクラスをこれほど重視するのは、まさにこのためである。

2.3.2 Impulse response examples2.3.2 脈衝響應範例2.3.2 インパルス応答の例

Feed $\delta[n]$ into the systems of §2.1 (Fig. 2-2):

把 $\delta[n]$ 餵進 §2.1 的各個系統(圖 2-2):

§2.1 のシステムに $\delta[n]$ を入れてみる(図 2-2):

$y[n]=a\,y[n-1]+x[n]$ 的 $h[n]=a^n u[n]$ 怎麼推出來?(點擊展開)
把 $x[n]=\delta[n]$ 餵進去,並假設初始靜止(initial rest:$n<0$ 時 $y[n]=0$)——因果系統的標準假設——然後逐拍遞推 $h[n]=a\,h[n-1]+\delta[n]$:
$n$$a\,h[n-1]$$+\,\delta[n]$$h[n]$
$<0$—$0$$0$(初始靜止)
$0$$a\cdot 0=0$$1$$1=a^0$
$1$$a\cdot 1=a$$0$$a=a^1$
$2$$a\cdot a=a^2$$0$$a^2$
$3$$a\cdot a^2=a^3$$0$$a^3$
$\delta[n]$ 只在 $n=0$ 「踢」一下,把 $h[0]$ 設成 1;之後沒有輸入,系統純靠遞迴(回授) $a\cdot(\text{上一拍})$ 自我延續,每拍乘一個 $a$: $$\boxed{h[n]=a^n\,u[n]}\qquad(u[n]\text{:只在 }n\ge0\text{ 存在}).$$ 驗證(代回原式):$n\ge1$ 時 $a\,h[n-1]+\delta[n]=a\cdot a^{n-1}+0=a^n=h[n]$ ✓; $n=0$ 時 $a\,h[-1]+1=0+1=1=a^0$ ✓。

直觀:這是「一個脈衝激發、之後自由衰減」的系統。$|a|<1$ 時 $a^n$ 越來越小 ⇒ 無限長但衰減(穩定的 IIR);$a=1$ 就退化成累加器 $h[n]=u[n]$。

「遞迴」還是「回授」?兩個是同一件事,只是視角不同:
  • 遞迴(recursive,數學/演算法視角):輸出由它自己的過去輸出定義——式子裡有 $y[n-1]$,「用自己算自己」。
  • 回授(feedback,結構/方塊圖視角):同一條 $y[n-1]$ 項,畫成方塊圖時就是把輸出繞回去乘 $a$ 再加進輸入,這條繞回路徑叫回授。
所以:有回授路徑 ⇔ 差分方程是遞迴的 ⇔ 一般就是 IIR——三者指向同一個機制,只是名字來自不同領域。
FIR vs IIR:「無限長」是什麼意思?跟穩定有關嗎?(點擊展開)
定義看的是脈衝響應 $h[n]$ 的長度:
  • FIR(Finite Impulse Response,有限脈衝響應):只有有限多項 $h[n]$ 非零。例:$M$ 點 MA,$h[n]=\tfrac1M$ 於 $0\le n\le M-1$,其餘為 0。
  • IIR(Infinite Impulse Response,無限脈衝響應):有無限多項非零(可能衰減,但不真正歸零)。例:累加器 $h[n]=u[n]$;一階遞迴 $h[n]=a^n u[n]$。
累加器為何是 IIR:餵 $\delta[n]$ 進 $y[n]=\sum_{k\le n}x[k]$ 得 $h[n]=\sum_{k\le n}\delta[k]=u[n]=\{\dots,0,\underset{n=0}{1},1,1,\dots\}$,從 $n=0$ 起永遠是 1、不歸零,往右無限延伸。

差別不只長度——關鍵在「回授」: IIR 通常來自遞迴/回授(輸出餵回自己),如 $y[n]=a\,y[n-1]+x[n]$: 一個脈衝進去會沿著 $y[n-1]$ 這條回授路徑不斷自我延續,所以拖到無限長。累加器就是 $a=1$ 的特例。 FIR 沒有回授(輸出只是輸入的有限加權和),脈衝過完那幾項就結束。

注意:「無限長」≠「不穩定」,是兩個不同概念。
  • 一階遞迴 $h[n]=a^n u[n]$,$|a|<1$ 時雖無限長但指數衰減 ⇒ BIBO 穩定(圖中 $a=0.8$)。
  • 累加器 $h[n]=u[n]$ 不衰減,$\sum_n|h[n]|=\infty$ ⇒ 不穩定(對應前面總表 Accumulator 的 Stable = No)。
「無限長」講的是 $h[n]$ 拖多久;「穩不穩定」看 $\sum|h[n]|$ 是否有限(§2.2.5)。
2026-06-12T22:22:27.489441 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 5 10 n 0.0 0.2 0.4 0.6 0.8 1.0 h[n] 5-point MA: h[n]=1/5, 0≤n≤4 0 5 10 n 0.0 0.2 0.4 0.6 0.8 1.0 Accumulator: h[n]=u[n] 0 5 10 n 0.0 0.2 0.4 0.6 0.8 1.0 Exponential: h[n]=(0.8)ⁿ u[n]
Fig. 2-2 — Example impulse responses: 5-point moving average (FIR, length 5), accumulator h[n]=u[n] (IIR, not absolutely summable), and the decaying exponential h[n]=(0.8)nu[n] (IIR but stable).
圖 2-2 — 三種典型脈衝響應:5 點移動平均(FIR,長度 5)、累加器 h[n]=u[n](IIR,不絕對可和),以及衰減指數 h[n]=(0.8)nu[n](IIR 但穩定)。
図 2-2 — インパルス応答の例:5 点移動平均(FIR、長さ 5)、累算器 h[n]=u[n](IIR、絶対可和でない)、そして減衰する指数 h[n]=(0.8)nu[n](IIR だが安定)。

2.4 The Convolution Sum2.4 卷積和2.4 畳み込み和

2.4.1 Definition and mechanics2.4.1 定義與計算機制2.4.1 定義と計算の仕組み

Convolution Sum 卷積和畳み込み和 $$y[n] \;=\; x[n] * h[n] \;=\; \sum_{k=-\infty}^{\infty} x[k]\,h[n-k] \;=\; \sum_{k=-\infty}^{\infty} h[k]\,x[n-k]$$

Two complementary readings of the same formula:

同一條公式有兩種互補的讀法:

同じ式には、互いに補い合う 2 通りの読み方がある:

Interpretation 1 — superposition of echoes讀法一 —— 回聲的疊加読み方 1 — こだまの重ね合わせ

Read $y[n] = \sum_k x[k]\,h[n-k]$ as a sum over input samples: every input sample $x[k]$ launches its own copy of the impulse response, scaled by $x[k]$ and delayed to start at time $k$. The output is the superposition of all these scaled, shifted echoes. This is the direct picture of "linearity + time invariance at work".

把 $y[n] = \sum_k x[k]\,h[n-k]$ 讀成對輸入樣本求和:每一個輸入樣本 $x[k]$ 都發出一份自己的脈衝響應複本,振幅被 $x[k]$ 縮放,並延遲到時刻 $k$ 才開始。輸出就是所有這些縮放、位移後回聲的疊加。這是「線性+非時變一起作用」最直接的圖像。

$y[n] = \sum_k x[k]\,h[n-k]$ を入力標本についての和として読む。どの入力標本 $x[k]$ も、$x[k]$ 倍されて時刻 $k$ から始まるように遅延された、自分自身のインパルス応答の複製を送り出す。出力は、こうしてスケールされ平行移動されたこだまをすべて重ね合わせたものである。これは「線形性+時不変性が働いている様子」をそのまま絵にしたものである。

Interpretation 2 — flip and slide(翻轉平移法)讀法二 —— 翻轉平移法(flip and slide)読み方 2 — 反転して滑らせる(翻轉平移法)

Read the formula one output sample at a time. To get the single number $y[n]$:

把公式一次只讀一個輸出樣本。要得到單一個數 $y[n]$:

この式を、出力標本 1 個ずつ読む。たった 1 つの数 $y[n]$ を得るには:

  1. Flip: time-reverse $h[k]$ to get $h[-k]$.
  2. Slide: shift it right by $n$ to get $h[n-k]$ (as a function of $k$).
  3. Multiply & sum: $y[n] = \sum_k x[k]\,h[n-k]$ — the inner product of the input with the flipped, shifted impulse response.
  4. Increment $n$ and repeat.
  1. 翻轉:把 $h[k]$ 時間反轉得到 $h[-k]$。
  2. 平移:把它右移 $n$ 得到 $h[n-k]$(視為 $k$ 的函數)。
  3. 相乘並求和:$y[n] = \sum_k x[k]\,h[n-k]$ —— 輸入與翻轉位移後脈衝響應的內積。
  4. 把 $n$ 加 1,重複上述步驟。
  1. 反転:$h[k]$ を時間反転して $h[-k]$ を得る。
  2. 平行移動:それを右へ $n$ だけずらして($k$ の関数として)$h[n-k]$ を得る。
  3. 掛けて足す:$y[n] = \sum_k x[k]\,h[n-k]$——入力と、反転・平行移動したインパルス応答との内積である。
  4. $n$ を 1 つ進めて繰り返す。

Fig. 2-3 walks through $x[n]=\{1,2,3,2,1\}$ convolved with $h[n]=\{1,1,1\}$: at $n=3$ the flipped window $h[3-k]$ overlaps $x[k]$ on $k=1,2,3$, giving $y[3]=2+3+2=7$.

圖 2-3 完整走過 $x[n]=\{1,2,3,2,1\}$ 與 $h[n]=\{1,1,1\}$ 的卷積:在 $n=3$ 時翻轉後的窗口 $h[3-k]$ 與 $x[k]$ 在 $k=1,2,3$ 重疊,得到 $y[3]=2+3+2=7$。

図 2-3 は $x[n]=\{1,2,3,2,1\}$ と $h[n]=\{1,1,1\}$ の畳み込みを順に追ったものである。$n=3$ では、反転した窓 $h[3-k]$ が $k=1,2,3$ で $x[k]$ と重なり、$y[3]=2+3+2=7$ となる。

2026-06-12T22:22:27.714451 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ −4 −2 0 2 4 6 8 k 0 1 2 3 x[k] = {1, 2, 3, 2, 1} −4 −2 0 2 4 6 8 k 0.0 0.2 0.4 0.6 0.8 1.0 h[k] = {1, 1, 1} −4 −2 0 2 4 6 8 k 0 1 2 3 n = 3: overlap k = 1..3 ⇒ y[3] = 2+3+2 = 7 x[k] h[3−k] (flipped, shifted) −4 −2 0 2 4 6 8 n 0 2 4 6 y[n] = x[n] ∗ h[n] = {1, 3, 6, 7, 6, 3, 1}
Fig. 2-3 — Flip-and-slide evaluation of x[n]∗h[n] with x = {1,2,3,2,1} and h = {1,1,1}. Bottom-left: at n = 3 the flipped, shifted window h[3−k] overlaps x[k] on k = 1…3 (shaded), so y[3] = 2+3+2 = 7. Bottom-right: the complete output, length 5+3−1 = 7.
圖 2-3 — 用翻轉平移法逐點計算 x[n]∗h[n],其中 x = {1,2,3,2,1}、h = {1,1,1}。左下:在 n = 3 時翻轉位移後的窗口 h[3−k] 與 x[k] 在 k = 1…3 重疊(陰影處),故 y[3] = 2+3+2 = 7。右下:完整輸出,長度 5+3−1 = 7。
図 2-3 — x = {1,2,3,2,1} と h = {1,1,1} に対する x[n]∗h[n] の「反転して滑らせる」計算。左下:n = 3 では、反転・平行移動した窓 h[3−k] が k = 1…3 で x[k] と重なり(網掛け部分)、y[3] = 2+3+2 = 7 となる。右下:完全な出力、長さは 5+3−1 = 7。
直觀解釋(點擊展開)
卷積有兩種等價的看法。看法一(疊加回聲):每一個輸入樣本 $x[k]$ 都會「敲」系統一下, 系統回應一個縮放 $x[k]$ 倍、延遲 $k$ 拍的脈衝響應;把所有回聲疊起來就是輸出。 看法二(翻轉平移):要算某一個輸出值 $y[n]$,先把 $h$ 左右翻轉、再平移 $n$ 格, 與 $x$ 對齊後逐點相乘再相加。手算考題時用看法二:畫出 $x[k]$ 與 $h[n-k]$, 找出重疊區間,逐段寫出 $y[n]$ 的公式。檢查答案的兩個小技巧: (1)輸出長度 $=N+M-1$;(2)$\sum_n y[n] = \bigl(\sum_n x[n]\bigr)\bigl(\sum_n h[n]\bigr)$。

2.4.2 Properties of convolution2.4.2 卷積的性質2.4.2 畳み込みの性質

Algebraic Properties 代數性質代数的性質 $$\begin{aligned} &\text{Commutative:} && x*h = h*x\\[2pt] &\text{Associative:} && (x*h_1)*h_2 = x*(h_1*h_2)\\[2pt] &\text{Distributive:} && x*(h_1+h_2) = x*h_1 + x*h_2\\[2pt] &\text{Identity:} && x[n]*\delta[n] = x[n]\\[2pt] &\text{Shift:} && x[n]*\delta[n-n_0] = x[n-n_0] \end{aligned}$$

Commutativity follows from the change of variables $m = n-k$ in the sum; it means "you may flip either signal" — always flip the shorter one. The associative and distributive properties are exactly what make cascade and parallel interconnections work (§2.5.3). Convolution is also linear in each argument and time-invariant: if $y = x*h$ then $x[n-n_0]*h[n] = y[n-n_0]$.

交換律來自求和中的變數代換 $m = n-k$;它的意思是「兩個訊號翻哪一個都可以」——永遠翻比較短的那個。結合律與分配律正是串聯與並聯互連之所以成立的原因(§2.5.3)。卷積對兩個引數也都是線性的,而且是非時變的:若 $y = x*h$,則 $x[n-n_0]*h[n] = y[n-n_0]$。

交換法則は、和の中で変数を $m = n-k$ と置き換えれば従う。これは「どちらの信号を反転してもよい」ということであり、つねに短い方を反転すればよい。結合法則と分配法則は、縦続接続と並列接続が成り立つ理由そのものである(§2.5.3)。畳み込みはまた、各引数について線形であり、かつ時不変でもある:$y = x*h$ ならば $x[n-n_0]*h[n] = y[n-n_0]$ が成り立つ。

2.4.3 Matrix interpretation2.4.3 矩陣觀點2.4.3 行列による解釈

For finite-length sequences, convolution is a matrix–vector product. With $x[n]$ of length $N$ and $h[n]$ of length $M$, stack $y = H\,x$ where $H$ is the $(N{+}M{-}1)\times N$ convolution (Toeplitz) matrix(卷積矩陣) whose columns are shifted copies of $h$. For $h=\{h_0,h_1,h_2\}$ and $N=5$:

對有限長度序列而言,卷積就是一個矩陣與向量的乘積。設 $x[n]$ 長度為 $N$、$h[n]$ 長度為 $M$,可以把輸出疊成 $y = H\,x$,其中 $H$ 是 $(N{+}M{-}1)\times N$ 的卷積矩陣(Toeplitz 矩陣),它的每一行都是 $h$ 的位移複本。以 $h=\{h_0,h_1,h_2\}$、$N=5$ 為例:

有限長の系列に対しては、畳み込みは行列とベクトルの積である。長さ $N$ の $x[n]$ と長さ $M$ の $h[n]$ について、$y = H\,x$ と書ける。ここで $H$ は $(N{+}M{-}1)\times N$ の畳み込み行列(Toeplitz 行列)(卷積矩陣)で、その各列は $h$ を平行移動した複製である。$h=\{h_0,h_1,h_2\}$、$N=5$ の場合:

Convolution as Matrix Product 把卷積寫成矩陣乘積行列の積としての畳み込み $$\begin{bmatrix} y[0]\\ y[1]\\ y[2]\\ y[3]\\ y[4]\\ y[5]\\ y[6] \end{bmatrix} = \begin{bmatrix} h_0 & 0 & 0 & 0 & 0\\ h_1 & h_0 & 0 & 0 & 0\\ h_2 & h_1 & h_0 & 0 & 0\\ 0 & h_2 & h_1 & h_0 & 0\\ 0 & 0 & h_2 & h_1 & h_0\\ 0 & 0 & 0 & h_2 & h_1\\ 0 & 0 & 0 & 0 & h_2 \end{bmatrix} \begin{bmatrix} x[0]\\ x[1]\\ x[2]\\ x[3]\\ x[4] \end{bmatrix}$$

Each column is the echo launched by one input sample (Interpretation 1); each row is the flipped window picking out one output sample (Interpretation 2). The constant-along-diagonals (Toeplitz) structure is time invariance written as a matrix.

每一行是某一個輸入樣本所發出的回聲(讀法一);每一列是翻轉後的窗口挑出某一個輸出樣本(讀法二)。「沿對角線為定值」的 Toeplitz 結構就是非時變性用矩陣寫出來的樣子。

各列は 1 つの入力標本が送り出したこだまであり(読み方 1)、各行は 1 つの出力標本を取り出す反転窓である(読み方 2)。対角線に沿って値が一定である(Toeplitz)という構造こそが、行列の形で書かれた時不変性である。

2.4.4 Support, length, and MATLAB2.4.4 支撐、長度與 MATLAB2.4.4 台・長さ・MATLAB

Key — output support rules
重點 — 輸出支撐的規則
要点 — 出力の台に関する規則
If $x[n]$ has length $N$ starting at index $n_x$, and $h[n]$ has length $M$ starting at $n_h$, then $y = x*h$ has length $\boxed{N+M-1}$, starting at index $n_x+n_h$ and ending at index $(n_x+N-1)+(n_h+M-1)$. Sanity checks: $y[\text{first}] = x[\text{first}]\,h[\text{first}]$ and $\sum_n y[n] = \left(\sum_n x[n]\right)\left(\sum_n h[n]\right)$.若 $x[n]$ 長度為 $N$、起始索引為 $n_x$,而 $h[n]$ 長度為 $M$、起始索引為 $n_h$,則 $y = x*h$ 的長度為 $\boxed{N+M-1}$,起始索引為 $n_x+n_h$,結束索引為 $(n_x+N-1)+(n_h+M-1)$。合理性檢查:$y[\text{首項}] = x[\text{首項}]\,h[\text{首項}]$,以及 $\sum_n y[n] = \left(\sum_n x[n]\right)\left(\sum_n h[n]\right)$。$x[n]$ がインデックス $n_x$ から始まる長さ $N$、$h[n]$ が $n_h$ から始まる長さ $M$ であるとき、$y = x*h$ の長さは $\boxed{N+M-1}$ であり、インデックス $n_x+n_h$ から始まって $(n_x+N-1)+(n_h+M-1)$ で終わる。検算:$y[\text{first}] = x[\text{first}]\,h[\text{first}]$、および $\sum_n y[n] = \left(\sum_n x[n]\right)\left(\sum_n h[n]\right)$。
x[n] N = 3, n_x = 1 h[n] M = 4, n_h = 2 ↓ ∗ ↓ y[n] N+M−1 = 6 1 2 3 4 5 6 7 8 start = n_x+n_h = 1+2 = 3 end = (n_x+N−1)+(n_h+M−1) = 8
Fig. 2-4b — Output support adds up: supports translate so $y$ starts where the two earliest samples align (at $n_x+n_h$) and ends where the two latest align; the count is $N+M-1$ (each end contributes one, the overlap is counted once). Here $3+4-1 = 6$ samples spanning indices $3\!\dots\!8$.
圖 2-4b — 輸出支撐相加:支撐會平移,所以 $y$ 從兩條序列最早的樣本對齊處開始($n_x+n_h$),到兩者最晚的樣本對齊處結束;樣本數為 $N+M-1$(頭尾各貢獻一個,重疊處只算一次)。此處為 $3+4-1 = 6$ 個樣本,索引跨越 $3\!\dots\!8$。
図 2-4b — 出力の台は足し算になる:台は平行移動するので、$y$ は最も早い 2 つの標本が重なる位置($n_x+n_h$)で始まり、最も遅い 2 つが重なる位置で終わる。個数は $N+M-1$ である(両端がそれぞれ 1 つ寄与し、重なりは 1 回だけ数える)。ここでは $3+4-1 = 6$ 標本で、インデックス $3\!\dots\!8$ にわたる。
MATLAB — conv
MATLAB — conv
MATLAB — conv
y = conv(x, h) returns the full length-$(N{+}M{-}1)$ result. MATLAB vectors carry no time origin — you must track the starting index: if x starts at $n_x$ and h at $n_h$, build the output axis as ny = (nx+nh) : (nx+nh+N+M-2). Plot discrete sequences with stem, never plot.y = conv(x, h) 回傳完整長度 $(N{+}M{-}1)$ 的結果。MATLAB 的向量不帶時間原點——追蹤起始索引是你的責任:若 x 從 $n_x$ 開始、h 從 $n_h$ 開始,就要自己把輸出的時間軸建成 ny = (nx+nh) : (nx+nh+N+M-2)。畫離散序列請用 stem,絕不要用 plot。y = conv(x, h) は長さ $(N{+}M{-}1)$ の完全な結果を返す。MATLAB のベクトルは時間原点をもたないので、開始インデックスは自分で管理しなければならない。x が $n_x$ から、h が $n_h$ から始まるなら、出力の時間軸は ny = (nx+nh) : (nx+nh+N+M-2) と作る。離散系列を描くときは必ず stem を使い、plot は使わないこと。

2.5 LTI System Properties via h[n]2.5 由 h[n] 判讀 LTI 系統性質2.5 h[n] から見た LTI システムの性質

Because $h[n]$ characterizes an LTI system completely, every system property of §2.2 must be readable directly from $h[n]$.

因為 $h[n]$ 完整刻畫了一個 LTI 系統,§2.2 的每一個系統性質都必須能直接從 $h[n]$ 讀出來。

$h[n]$ は LTI システムを完全に特徴づけるので、§2.2 のシステムの性質はどれも $h[n]$ から直接読み取れるはずである。

2.5.1 Causality ⇔ h[n] = 0 for n < 02.5.1 因果性 ⇔ 對 n < 0 有 h[n] = 02.5.1 因果性 ⇔ n < 0 で h[n] = 0

LTI Causality Test LTI 因果性判據LTI の因果性判定 $$\text{LTI system causal} \iff h[n] = 0 \ \text{ for all } n < 0$$

Why: in $y[n] = \sum_k h[k]\,x[n-k]$, the terms with $k<0$ involve $x[n-k]$ with $n-k > n$ — future inputs. They vanish for every input iff $h[k]=0$ for $k<0$. ($\Leftarrow$) is immediate; ($\Rightarrow$) follows because $h[n]$ is itself the response to $\delta[n]$: a causal system cannot respond before the impulse arrives at $n=0$. A sequence with this property is called a causal sequence.

原因:在 $y[n] = \sum_k h[k]\,x[n-k]$ 中,$k<0$ 的項牽涉到 $n-k > n$ 的 $x[n-k]$——也就是未來的輸入。要讓這些項對每一個輸入都消失,充要條件是 $k<0$ 時 $h[k]=0$。($\Leftarrow$)方向是顯然的;($\Rightarrow$)方向成立是因為 $h[n]$ 本身就是對 $\delta[n]$ 的響應:因果系統不可能在脈衝於 $n=0$ 抵達之前就有反應。具有這個性質的序列稱為因果序列。

理由:$y[n] = \sum_k h[k]\,x[n-k]$ において、$k<0$ の項には $n-k > n$ なる $x[n-k]$——つまり未来の入力——が現れる。これがあらゆる入力について消えるのは、$k<0$ で $h[k]=0$ となるとき、かつそのときに限る。($\Leftarrow$)は直ちに従う。($\Rightarrow$)は $h[n]$ 自身が $\delta[n]$ に対する応答であることから従う:因果的なシステムが、$n=0$ にインパルスが到着する前に応答することはできない。この性質をもつ系列を因果系列という。

2.5.2 Stability ⇔ absolute summability2.5.2 穩定性 ⇔ 絕對可和2.5.2 安定性 ⇔ 絶対可和性

LTI BIBO Test LTI BIBO 判據LTI の BIBO 判定 $$\color{#c0392b}{\boldsymbol{\text{LTI system BIBO stable} \iff S \;=\; \sum_{k=-\infty}^{\infty} \bigl|h[k]\bigr| < \infty}}$$
Proof sketch (both directions)證明概要(兩個方向)証明の概略(両方向)
Sufficiency ($S<\infty$ ⇒ stable): if $|x[n]|\le B_x$, $$|y[n]| = \Bigl|\sum_k h[k]\,x[n-k]\Bigr| \le \sum_k |h[k]|\,|x[n-k]| \le B_x \sum_k |h[k]| = B_x S < \infty.$$
充分性($S<\infty$ ⇒ 穩定):若 $|x[n]|\le B_x$,則 $$|y[n]| = \Bigl|\sum_k h[k]\,x[n-k]\Bigr| \le \sum_k |h[k]|\,|x[n-k]| \le B_x \sum_k |h[k]| = B_x S < \infty.$$
十分性($S<\infty$ ⇒ 安定):$|x[n]|\le B_x$ ならば $$|y[n]| = \Bigl|\sum_k h[k]\,x[n-k]\Bigr| \le \sum_k |h[k]|\,|x[n-k]| \le B_x \sum_k |h[k]| = B_x S < \infty.$$
Necessity ($S=\infty$ ⇒ unstable): choose the bounded adversarial input(有界對抗性輸入,最壞情況)$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr)$ (so $|x[n]|\le1$). Then $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S = \infty,$$ so one output sample already diverges.
必要性($S=\infty$ ⇒ 不穩定):取有界對抗性輸入(bounded adversarial input,最壞情況)$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr)$(於是 $|x[n]|\le1$)。則 $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S = \infty,$$ 光是一個輸出樣本就已經發散了。
必要性($S=\infty$ ⇒ 不安定):有界な敵対的入力(有界對抗性輸入,最壞情況)$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr)$ を選ぶ(こうすれば $|x[n]|\le1$)。すると $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S = \infty,$$ となり、出力標本 1 個だけですでに発散している。
Examples: MA: $\sum|h| = M\cdot\frac1M = 1$ → stable. Accumulator: $\sum_n |u[n]| = \infty$ → unstable (consistent with Fig. 2-4). $h[n]=a^n u[n]$: $\sum_{n\ge0}|a|^n = \frac{1}{1-|a|}$ if $|a|<1$ → stable iff $|a|<1$.
例子:移動平均:$\sum|h| = M\cdot\frac1M = 1$ → 穩定。累加器:$\sum_n |u[n]| = \infty$ → 不穩定(與圖 2-4 一致)。$h[n]=a^n u[n]$:當 $|a|<1$ 時 $\sum_{n\ge0}|a|^n = \frac{1}{1-|a|}$ → 穩定的充要條件是 $|a|<1$。
例:移動平均:$\sum|h| = M\cdot\frac1M = 1$ → 安定。累算器:$\sum_n |u[n]| = \infty$ → 不安定(図 2-4 と整合する)。$h[n]=a^n u[n]$:$|a|<1$ なら $\sum_{n\ge0}|a|^n = \frac{1}{1-|a|}$ → $|a|<1$ のとき、かつそのときに限り安定。
What is a “bounded adversarial input”?
什麼是「有界對抗性輸入」?(bounded adversarial input)
「有界な敵対的入力」とは何か

Adversarial means an input deliberately constructed to break the system — the worst case. It must still be bounded ($|x[n]|\le1$), because the definition of BIBO stability demands a bounded output for every bounded input, which entitles us to pick the nastiest one.

對抗性(adversarial)指的是刻意構造、用來「打垮」系統的最壞情況輸入,但它仍必須是有界的($|x[n]|\le1$)——因為 BIBO 的定義就是「任何有界輸入」都要產生有界輸出,所以我們有權挑選最刁鑽的那一個。

敵対的とは、システムを壊すために意図的に構成された入力、すなわち最悪の場合を指す。それでいて有界($|x[n]|\le1$)でなければならない。BIBO 安定性の定義はあらゆる有界入力に対して有界な出力を要求するので、こちらは最も意地の悪いものを選ぶ権利がある。

To prove a system unstable you only need one bounded input whose output diverges. So rather than taking an arbitrary input we take the most malicious one: $$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr).$$

要證明系統不穩定,只需找到一個有界輸入使輸出發散即可。因此不隨便取,而是選最「惡意」的: $$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr).$$

システムが不安定であることを示すには、出力が発散する有界入力が1 つあれば足りる。そこで任意の入力をとるのではなく、最も悪意のあるものをとる: $$x[n] = \operatorname{sgn}\!\bigl(h[-n]\bigr).$$

Its cleverness is that at $n=0$ the signs line up with every $h[k]$: $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\,\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S.$$ Every term becomes $+|h[k]|$, so nothing cancels and everything adds with the same sign (constructive superposition) — which is exactly the worst case. If $S=\infty$, that single output sample $y[0]$ already diverges, so the system cannot be stable.

它的巧妙之處在於 $n=0$ 時,符號剛好對齊每個 $h[k]$: $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\,\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S.$$ 每一項都變成 $+|h[k]|$,沒有任何抵消、全部同號相加(建設性疊加)——這正是最壞情況。若 $S=\infty$,則單一個輸出樣本 $y[0]$ 就已發散,系統必不穩定。

この巧妙さは、$n=0$ において符号がすべての $h[k]$ と揃うことにある: $$y[0] = \sum_k h[k]\,x[-k] = \sum_k h[k]\,\operatorname{sgn}(h[k]) = \sum_k |h[k]| = S.$$ どの項も $+|h[k]|$ になるので、何も打ち消し合わず、すべてが同じ符号で足し合わされる(強め合う重ね合わせ)——これがまさに最悪の場合である。$S=\infty$ であれば、この出力標本 $y[0]$ ただ 1 つですでに発散するので、そのシステムは安定ではありえない。

In short: a bounded adversarial input = bounded (a legal test input) + sign-aligned (maximizing the output), the cleanest construction there is for exposing instability.

總結:有界對抗性輸入 = 有界(合法測試輸入)+ 符號對齊(使輸出最大化),是揭露系統不穩定最乾淨俐落的構造。

要するに、有界な敵対的入力 = 有界(判定に使ってよい入力)+ 符号が揃っている(出力を最大化する)であり、不安定性をあぶり出すこれ以上ないほど端正な構成である。

Why $h[-n]$ and not $h[n]$?
為什麼用 $h[-n]$ 而不是 $h[n]$?
なぜ $h[n]$ ではなく $h[-n]$ なのか

The reason is the time reversal (the flip) that convolution already contains. At $n=0$ the output is $$y[0] = \sum_k h[k]\,x[0-k] = \sum_k h[k]\,x[-k].$$ Note that the input is indexed by $-k$, not $k$. To make every term add with the same sign we therefore need $$x[-k] = \operatorname{sgn}(h[k]) \quad\text{for all } k.$$

關鍵在於卷積本身內建的時間反轉(翻摺,flip)。輸出在 $n=0$ 時為 $$y[0] = \sum_k h[k]\,x[0-k] = \sum_k h[k]\,x[-k].$$ 注意輸入的索引是 $-k$ 而不是 $k$。要讓每一項都同號相加,必須讓 $$x[-k] = \operatorname{sgn}(h[k]) \quad\text{對所有 } k.$$

理由は、畳み込みがすでに内部にもっている時間反転(反転操作)にある。$n=0$ での出力は $$y[0] = \sum_k h[k]\,x[0-k] = \sum_k h[k]\,x[-k].$$ 入力の添字が $k$ ではなく $-k$ であることに注意せよ。したがって、どの項も同じ符号で足し合わされるようにするには $$x[-k] = \operatorname{sgn}(h[k]) \quad\text{for all } k.$$ が必要である。

Substituting $m=-k$ (that is, $k=-m$) gives $$x[m] = \operatorname{sgn}(h[-m]) \;\Longrightarrow\; x[n] = \operatorname{sgn}(h[-n]).$$ That $h[-n]$ is precisely what cancels the flip inside the convolution — two reversals undo each other, and substituting back: $$y[0]=\sum_k h[k]\,\underbrace{\operatorname{sgn}(h[k])}_{x[-k]}=\sum_k|h[k]|=S.$$

令 $m=-k$(即 $k=-m$)代換,得 $$x[m] = \operatorname{sgn}(h[-m]) \;\Longrightarrow\; x[n] = \operatorname{sgn}(h[-n]).$$ 這個 $h[-n]$ 正好抵消卷積的翻摺——兩次反轉互相抵消,代回後: $$y[0]=\sum_k h[k]\,\underbrace{\operatorname{sgn}(h[k])}_{x[-k]}=\sum_k|h[k]|=S.$$

$m=-k$(すなわち $k=-m$)と置き換えると $$x[m] = \operatorname{sgn}(h[-m]) \;\Longrightarrow\; x[n] = \operatorname{sgn}(h[-n]).$$ が得られる。この $h[-n]$ こそが畳み込みの内部にある反転を打ち消すものである——2 回の反転は互いに打ち消し合う。代入し直すと: $$y[0]=\sum_k h[k]\,\underbrace{\operatorname{sgn}(h[k])}_{x[-k]}=\sum_k|h[k]|=S.$$

If we used $x[n]=\operatorname{sgn}(h[n])$ instead, then $x[-k]=\operatorname{sgn}(h[-k])$, whose signs no longer match $h[k]$; the terms would partly cancel and the sum could not be driven up to $S$. That minus sign exists solely to match the flip built into convolution.

若改用 $x[n]=\operatorname{sgn}(h[n])$,則 $x[-k]=\operatorname{sgn}(h[-k])$,符號與 $h[k]$ 對不上,各項會部分抵消,無法把總和逼到 $S$。那個負號的存在,完全是為了配合卷積的翻摺。

もし代わりに $x[n]=\operatorname{sgn}(h[n])$ としていたら、$x[-k]=\operatorname{sgn}(h[-k])$ となり、その符号はもはや $h[k]$ と一致しない。項は部分的に打ち消し合い、和を $S$ まで押し上げることはできない。あのマイナス符号は、ひとえに畳み込みに組み込まれた反転と帳尻を合わせるために存在している。

So can we not take the sign without flipping? We can — taking the sign needs no flip at all. The two operations are independent and serve different purposes. The flip is not there to obtain the sign; it is there to cancel the flip convolution performs by itself:

那「不左右翻摺」就不能取符號嗎?能——取符號(sgn)本身完全不需要翻摺,這兩件事是獨立、目的不同的。翻摺不是為了取得符號,而是為了抵消卷積自己內建的翻摺:

では反転せずに符号だけ取ってはいけないのか。取ってよい——符号を取る操作に反転はまったく要らない。この 2 つの操作は独立であり、目的も異なる。反転は符号を得るためにあるのではなく、畳み込みが自分で行う反転を打ち消すためにある:

  • Taking the sign (sgn): throws away the magnitude and keeps only $\pm1$ — this makes the input bounded ($|x|\le1$) and makes every term add with the same sign.
  • Flipping $n\to-n$: mirrors the signal — this cancels the $x[-k]$ in the convolution formula.
  • 取符號 sgn:丟掉大小、只留 $\pm1$ — 讓輸入有界($|x|\le1$)且各項同號相加。
  • 左右翻摺 $n\to-n$:把訊號鏡射 — 抵消卷積公式裡的 $x[-k]$。
  • 符号を取る(sgn):大きさを捨てて $\pm1$ だけを残す——これによって入力が有界($|x|\le1$)になり、どの項も同じ符号で足し合わされるようになる。
  • $n\to-n$ と反転する:信号を鏡映する——これが畳み込みの式に現れる $x[-k]$ を打ち消す。

Because the input inside $y[0]=\sum_k h[k]\,x[\boldsymbol{-k}]$ has already been flipped once by the convolution. What we want is $x[-k]=\operatorname{sgn}(h[k])$, so $x$ itself must be laid down backwards first; convolution flips it a second time and it comes out the right way round — the two flips cancel. In one line: the sign takes care of “bounded and same-signed”, the flip takes care of “matching the $-k$ of the convolution”. Both are needed and neither replaces the other.

因為輸出 $y[0]=\sum_k h[k]\,x[\boldsymbol{-k}]$ 中的輸入已被卷積翻過一次;我要的是 $x[-k]=\operatorname{sgn}(h[k])$,所以 $x$ 本身必須先反著放,被卷積再翻一次後才正過來——兩次翻摺剛好抵消。簡言之:符號管「有界+同號」,翻摺管「對齊卷積的 $-k$」,兩者缺一不可,但互不替代。

$y[0]=\sum_k h[k]\,x[\boldsymbol{-k}]$ の中の入力は、畳み込みによってすでに 1 度反転されているからである。こちらが欲しいのは $x[-k]=\operatorname{sgn}(h[k])$ なので、$x$ 自体をまず逆向きに並べておく必要がある。畳み込みがそれをもう 1 度反転すると、正しい向きで出てくる——2 回の反転が打ち消し合うのである。一言でいえば、符号が「有界かつ同符号」を引き受け、反転が「畳み込みの $-k$ との辻褄合わせ」を引き受ける。どちらも必要であり、一方が他方の代わりにはならない。

① h[k]:我們要對齊的符號(落在 k ≥ 0) 0 1 2 3 + − 翻摺① 我們故意反著放:x[n] = sgn(h[−n]),落在 n ≤ 0 ↓ ② x[n] = sgn(h[−n])(建構出的輸入,落在 n ≤ 0) 0 −1 −2 −3 翻摺② 卷積自動取 x[−k]:再翻回 k ≥ 0 ↓ ③ x[−k]:卷積翻回後,與 ① 同號 ✓ 0 1 2 3 ✓ ✓ ✓ ✓ x[−k] 與 h[k] 同號 ⇒ h[k]·x[−k] = |h[k]| 全為正
Fig. 2-5c — The two flips cancel: ① $h[k]$ carries the signs we want to line up with; ② we deliberately lay the input down backwards as $x[n]=\operatorname{sgn}(h[-n])$ (supported on $n\le0$); ③ when convolution computes $y[0]=\sum_k h[k]\,x[-k]$ it flips it once more automatically, taking $x[-k]$ back to $k\ge0$ with exactly the same signs as ①, so every term $h[k]\,x[-k]=|h[k]|$ is positive and $y[0]=S$.
Fig. 2-5c — 兩次翻摺剛好抵消(two flips cancel):① $h[k]$ 是我們想對齊的符號;② 我們故意把輸入反著放成 $x[n]=\operatorname{sgn}(h[-n])$(落在 $n\le0$);③ 卷積在算 $y[0]=\sum_k h[k]\,x[-k]$ 時自動再翻一次取 $x[-k]$,把它翻回 $k\ge0$ 並與 ① 完全同號,因此每項 $h[k]\,x[-k]=|h[k]|$ 全為正,$y[0]=S$。
図 2-5c — 2 つの反転が打ち消し合う様子:① $h[k]$ が、揃えたい符号をもっている。② こちらは意図的に入力を逆向きに $x[n]=\operatorname{sgn}(h[-n])$ と並べる(台は $n\le0$)。③ 畳み込みが $y[0]=\sum_k h[k]\,x[-k]$ を計算するとき自動的にもう 1 度反転するので、$x[-k]$ は ① とまったく同じ符号で $k\ge0$ に戻る。その結果どの項も $h[k]\,x[-k]=|h[k]|$ と正になり、$y[0]=S$ となる。
① h[n] 原本的脈衝響應 混合正負號 0 1 2 3 翻摺 flip:n → −n(左右鏡射)↓ ② h[−n] 時間反轉 0 −1 −2 −3 取符號 sgn:只留 ±1,丟掉大小 ↓ ③ x[n] = sgn(h[−n]) 對抗輸入 |x[n]| ≤ 1 有界 +1 −1 0 −1 −2 −3
Fig. 2-5b — Construction of the adversarial input: flip $h[n]$ into $h[-n]$, then take the sign to get $x[n]=\operatorname{sgn}(h[-n])$. This makes $x[-k]=\operatorname{sgn}(h[k])$ agree in sign with $h[k]$, so $y[0]=\sum_k|h[k]|=S$ (green = positive, red = negative).
Fig. 2-5b — 對抗輸入的構造(construction of the adversarial input):把 $h[n]$ 左右翻摺成 $h[-n]$,再取符號得 $x[n]=\operatorname{sgn}(h[-n])$。如此一來 $x[-k]=\operatorname{sgn}(h[k])$ 與 $h[k]$ 同號,使 $y[0]=\sum_k|h[k]|=S$(綠色=正、紅色=負)。
図 2-5b — 敵対的入力の構成:$h[n]$ を反転して $h[-n]$ とし、次に符号を取って $x[n]=\operatorname{sgn}(h[-n])$ を得る。こうすると $x[-k]=\operatorname{sgn}(h[k])$ が $h[k]$ と符号で一致し、$y[0]=\sum_k|h[k]|=S$ となる(緑=正、赤=負)。

So what does $y[0]$ actually come out to if we really convolve ① $h[k]$ with ③ $x[-k]$? Here it is step by step (still with $h=[0.8,-0.5,0.3,-0.2]$):

那把 ① $h[k]$ 和 ③ $x[-k]$ 真的卷積起來,$y[0]$ 是什麼結果?下面一步一步算(仍用 $h=[0.8,-0.5,0.3,-0.2]$):

では ① $h[k]$ と ③ $x[-k]$ を実際に畳み込むと、$y[0]$ はいくつになるのか。手順を追って見てみよう(引き続き $h=[0.8,-0.5,0.3,-0.2]$ とする):

步驟① 對齊 h[k] 與 x[−k](k = 0,1,2,3) h[k] x[−k] +0.8 −0.5 +0.3 −0.2 +1 −1 +1 −1 k=0 步驟② 逐項相乘 h[k]·x[−k] (負×負 = 正,全部翻正) 0.8×(+1) (−0.5)×(−1) 0.3×(+1) (−0.2)×(−1) 0.8 0.5 0.3 0.2 = |h[k]| 步驟③ 全部相加 → y[0] = ∑ |h[k]| = S 0.8 0.5 0.3 0.2 0.8 1.3 1.6 1.8 y[0] = 0.8 + 0.5 + 0.3 + 0.2 = 1.8 = ∑|h[k]| = S 沒有任何抵消,全部同號相加 → 這就是輸出能達到的最大值(最壞情況)
Fig. 2-5d — The convolution ①$\,*\,$③ at $n=0$: once aligned, the terms are multiplied one by one, and because $x[-k]=\operatorname{sgn}(h[k])$ every product becomes $+|h[k]|$ (negative times negative is positive); adding them all gives $y[0]=\sum_k|h[k]|=S=1.8$. This is the arithmetic behind “one bounded input already drives the output up to $S$” in the instability proof.
Fig. 2-5d — ①$\,*\,$③ 在 $n=0$ 的卷積結果(the convolution at $n=0$):對齊後逐項相乘,因 $x[-k]=\operatorname{sgn}(h[k])$ 使每個乘積都變成 $+|h[k]|$(負乘負為正),全部相加得 $y[0]=\sum_k|h[k]|=S=1.8$。這正是不穩定判據裡「一個有界輸入就能讓輸出衝到 $S$」的算術過程。
図 2-5d — $n=0$ における畳み込み ①$\,*\,$③:位置を合わせたうえで項を 1 つずつ掛け合わせると、$x[-k]=\operatorname{sgn}(h[k])$ であるため、どの積も $+|h[k]|$ になる(負かける負は正)。それらをすべて足すと $y[0]=\sum_k|h[k]|=S=1.8$ となる。これが、不安定性の証明でいう「有界な入力 1 つだけで出力がすでに $S$ まで押し上げられる」ことの算術的な中身である。
Does shifting the input right by 4 change anything? (Time invariance)
把輸入右移 4,結果會變嗎?(時間不變性 time invariance)
入力を右へ 4 だけずらすと何か変わるのか(時不変性)

No. By the time invariance of convolution, delaying the input by $4$ merely delays the output by $4$; the values are unchanged. With $x'[n]=x[n-4]$, $$y'[n]=(h*x')[n]=(h*x)[n-4]=y[n-4]\quad\Longrightarrow\quad y'[4]=y[0]=S=1.8.$$

不變。由卷積的時間不變性:把輸入延遲 $4$,輸出也只是跟著延遲 $4$,數值完全不變。設 $x'[n]=x[n-4]$,則 $$y'[n]=(h*x')[n]=(h*x)[n-4]=y[n-4]\quad\Longrightarrow\quad y'[4]=y[0]=S=1.8.$$

変わらない。畳み込みの時不変性により、入力を $4$ だけ遅らせても出力が $4$ だけ遅れるにすぎず、値は変わらない。$x'[n]=x[n-4]$ とすると、 $$y'[n]=(h*x')[n]=(h*x)[n-4]=y[n-4]\quad\Longrightarrow\quad y'[4]=y[0]=S=1.8.$$

Direct evaluation agrees: $y'[4]=\sum_k h[k]\,x'[4-k]=\sum_k h[k]\,x[-k]=y[0].$ In other words the whole picture just slides 4 steps to the right: the position at which the peak $S$ appears changes, its size does not. This also explains why the proof may pick $n=0$ freely — any sample at which the signs line up equals $S$.

直接驗算也一致:$y'[4]=\sum_k h[k]\,x'[4-k]=\sum_k h[k]\,x[-k]=y[0].$ 換句話說整張圖只是往右滑 4 格,峰值 $S$ 出現的位置變了,大小沒變。這也說明證明裡為何可以隨意挑 $n=0$ 來算——任何一個「符號全對齊」的樣本都等於 $S$。

直接計算しても一致する:$y'[4]=\sum_k h[k]\,x'[4-k]=\sum_k h[k]\,x[-k]=y[0].$ 言い換えれば絵全体がそのまま右へ 4 歩ずれるだけであり、ピーク $S$ が現れる位置は変わるが、その大きさは変わらない。これは、証明が $n=0$ を自由に選んでよい理由でもある——符号が揃う標本であれば、どれをとっても値は $S$ になる。

原始輸出 y[n] (輸入 x[n] 落在 n = −3 … 0) y[0]=1.8=S −3 −2 −1 0 1 2 3 整段右移 4:y[n] → y[n−4],S 不變 右移後 y′[n]=y[n−4] (輸入 x′[n] 落在 n = 1 … 4) y′[4]=1.8=S 1 2 3 4 5 6 7
Fig. 2-5e — Time invariance: shifting the input right by $4$ slides the entire output $y[n]$ right by $4$, unchanged, into $y'[n]=y[n-4]$. The peak $S=1.8$ that was at $n=0$ moves to $n=4$; same value, same shape — only the position changes.
Fig. 2-5e — 時間不變性(time invariance):把輸入右移 $4$,整條輸出 $y[n]$ 原封不動往右滑 $4$ 格成 $y'[n]=y[n-4]$。原本在 $n=0$ 的峰值 $S=1.8$ 移到 $n=4$,數值不變、形狀不變——只有位置改變。
図 2-5e — 時不変性:入力を右へ $4$ ずらすと、出力 $y[n]$ 全体がそのまま右へ $4$ ずれて $y'[n]=y[n-4]$ になる。$n=0$ にあったピーク $S=1.8$ は $n=4$ へ移る。値も形も同じで、変わるのは位置だけである。
Only $n=0$ guarantees “all positive, summing to $S$”; other indices cancel
只有 $n=0$ 保證「全正相加 = S」,其他索引會抵消
「すべて正で、和が $S$ になる」ことを保証するのは $n=0$ だけ。他のインデックスでは打ち消し合う

Correct. The adversarial input is tuned specifically for $n=0$ ($x[-k]=\operatorname{sgn}(h[k])$), so $n=0$ is the only index at which every term is positive: $$y[0]=\sum_k h[k]\,\underbrace{x[-k]}_{=\,\operatorname{sgn}(h[k])}=\sum_k |h[k]|=0.8+0.5+0.3+0.2=1.8=S.$$ At other indices the alignment is lost, the signs are mixed and terms partly cancel; at the ends only a single term survives (so it is not really a “sum” at all):

對。對抗輸入是專為 $n=0$ 調好的($x[-k]=\operatorname{sgn}(h[k])$),所以唯有在 $n=0$ 每一項都同號為正: $$y[0]=\sum_k h[k]\,\underbrace{x[-k]}_{=\,\operatorname{sgn}(h[k])}=\sum_k |h[k]|=0.8+0.5+0.3+0.2=1.8=S.$$ 其他索引對不齊,符號混雜、部分抵消,甚至端點只剩單一項(根本不是「和」):

そのとおりである。敵対的入力は$n=0$ に合わせて特別に調整されている($x[-k]=\operatorname{sgn}(h[k])$)ので、すべての項が正になるインデックスは $n=0$ だけである: $$y[0]=\sum_k h[k]\,\underbrace{x[-k]}_{=\,\operatorname{sgn}(h[k])}=\sum_k |h[k]|=0.8+0.5+0.3+0.2=1.8=S.$$ 他のインデックスでは位置合わせが崩れ、符号が入り混じって項が部分的に打ち消し合う。端では項が 1 つしか残らない(したがってそもそも「和」ですらない):

$n$terms$y[n]$
$-3$only $h[0]x[-3]=0.8(-1)$ (a single term)$-0.8$
$-2$$0.8(+1)+(-0.5)(-1)$$+1.3$
$-1$$0.8(-1)+(-0.5)(+1)+0.3(-1)$ (all negative)$-1.6$
$0$$0.8+0.5+0.3+0.2$ (all positive)$+1.8=S$
$1$mixed signs$-1.0$
$2$mixed signs$+0.5$
$3$only $h[3]x[0]=-0.2$ (a single term)$-0.2$
$n$各項$y[n]$
$-3$只有 $h[0]x[-3]=0.8(-1)$(單一項)$-0.8$
$-2$$0.8(+1)+(-0.5)(-1)$$+1.3$
$-1$$0.8(-1)+(-0.5)(+1)+0.3(-1)$(全負)$-1.6$
$0$$0.8+0.5+0.3+0.2$(全正)$+1.8=S$
$1$混合正負$-1.0$
$2$混合正負$+0.5$
$3$只有 $h[3]x[0]=-0.2$(單一項)$-0.2$
$n$項$y[n]$
$-3$$h[0]x[-3]=0.8(-1)$ のみ(1 項だけ)$-0.8$
$-2$$0.8(+1)+(-0.5)(-1)$$+1.3$
$-1$$0.8(-1)+(-0.5)(+1)+0.3(-1)$(すべて負)$-1.6$
$0$$0.8+0.5+0.3+0.2$(すべて正)$+1.8=S$
$1$符号が混在$-1.0$
$2$符号が混在$+0.5$
$3$$h[3]x[0]=-0.2$ のみ(1 項だけ)$-0.2$

Compare the magnitudes: $|y[n]| = 0.8,\,1.3,\,1.6,\,\mathbf{1.8},\,1.0,\,0.5,\,0.2$ — the peak $1.8$ occurs only at $n=0$ and every other sample is strictly smaller. That is why the proof reads $y[0]$ alone: it is the one sample guaranteed to reach $S$, and if $S=\infty$ that single sample already diverges ⇒ the system is unstable.

比較大小:$|y[n]| = 0.8,\,1.3,\,1.6,\,\mathbf{1.8},\,1.0,\,0.5,\,0.2$——峰值 $1.8$ 只在 $n=0$ 出現,其餘樣本嚴格較小。這就是證明只讀 $y[0]$ 的原因:它是唯一保證 $|y|$ 達到 $S$ 的樣本;若 $S=\infty$,光這一個樣本就發散 ⇒ 系統不穩定。

大きさを比べてみよう:$|y[n]| = 0.8,\,1.3,\,1.6,\,\mathbf{1.8},\,1.0,\,0.5,\,0.2$——ピークの $1.8$ は$n=0$ でしか現れず、他の標本はすべて厳密に小さい。証明が $y[0]$ だけを読むのはこのためである。$S$ に到達することが保証された唯一の標本であり、$S=\infty$ ならばその 1 標本だけですでに発散する ⇒ システムは不安定である。

2.5.3 Connected systems: cascade and parallel2.5.3 系統的連接:串聯與並聯2.5.3 システムの接続:縦続と並列

The convolution algebra of §2.4.2 translates directly into block-diagram rules (Fig. 2-5):

§2.4.2 的卷積代數可以直接翻譯成方塊圖的規則(圖 2-5):

§2.4.2 の畳み込みの代数は、そのままブロック図の規則に翻訳される(図 2-5):

x[n] h₁[n] h₂[n] y[n] ≡ x[n] h₁[n] ∗ h₂[n] y[n] Cascade: convolve impulse responses x[n] h₁[n] h₂[n] y[n] ≡ x[n] h₁[n] + h₂[n] y[n] Parallel: add impulse responses
Fig. 2-5 — Connected LTI systems: a cascade is equivalent to a single system with $h_1*h_2$ (the order may be interchanged); a parallel connection is equivalent to $h_1+h_2$.
圖 2-5 — LTI 系統的連接:串聯等效於單一個 $h_1*h_2$ 的系統(順序可以互換);並聯則等效於 $h_1+h_2$。
図 2-5 — LTI システムの接続:縦続接続は $h_1*h_2$ という 1 つのシステムと等価であり(順序は入れ替えてよい)、並列接続は $h_1+h_2$ と等価である。

2.5.4 Inverse systems2.5.4 反系統2.5.4 逆システム

A system $h_i[n]$ is the inverse(反系統) of $h[n]$ if their cascade is the identity system:

系統 $h_i[n]$ 是 $h[n]$ 的反系統(inverse system),如果兩者串聯後等於恆等系統:

システム $h_i[n]$ が $h[n]$ の逆システム(反系統)であるとは、両者を縦続接続したものが恒等システムになることをいう:

Inverse System 反系統逆システム $$h[n] * h_i[n] = \delta[n] \quad\Longrightarrow\quad x[n] \to \boxed{h} \to \boxed{h_i} \to x[n]$$
Example 2.4 — Accumulator and first difference are inverses範例 2.4 —— 累加器與一階差分互為反系統例 2.4 — 累算器と 1 階差分は互いに逆システム
Accumulator: $h[n]=u[n]$. Backward first difference: $h_i[n]=\delta[n]-\delta[n-1]$.
累加器:$h[n]=u[n]$。後向一階差分:$h_i[n]=\delta[n]-\delta[n-1]$。
累算器:$h[n]=u[n]$。後退 1 階差分:$h_i[n]=\delta[n]-\delta[n-1]$。
Check the cascade using the shift property: $$u[n]*\bigl(\delta[n]-\delta[n-1]\bigr) = u[n]-u[n-1] = \delta[n]. \checkmark$$
用位移性質驗證串聯結果: $$u[n]*\bigl(\delta[n]-\delta[n-1]\bigr) = u[n]-u[n-1] = \delta[n]. \checkmark$$
シフトの性質を使って縦続接続を確かめる: $$u[n]*\bigl(\delta[n]-\delta[n-1]\bigr) = u[n]-u[n-1] = \delta[n]. \checkmark$$
Interpretation: differencing undoes accumulation, exactly as differentiation undoes integration. Inverse systems are the foundation of equalization(等化)— undoing the distortion of a channel by cascading it with its inverse.
解讀:差分抵消累加,就像微分抵消積分一樣。反系統是等化(equalization)的理論基礎——把通道與它的反系統串聯起來,就能抵消通道造成的失真。
解釈:微分が積分を打ち消すのとまったく同じように、差分は累算を打ち消す。逆システムは等化(等化)の基礎である——チャネルの歪みを、その逆システムを縦続接続することで取り消すのである。
Warning — inverses are not always nice
注意 — 反系統不一定好用
注意 — 逆システムは必ずしも扱いやすくない
The inverse of a perfectly causal, stable system may be non-causal or unstable. Existence and properties of $h_i[n]$ are much easier to discuss with the $z$-transform (poles and zeros swap roles) — a preview of later chapters.一個完全因果且穩定的系統,它的反系統可能是非因果或不穩定的。用 $z$ 轉換來討論 $h_i[n]$ 的存在性與性質會容易得多(極點與零點的角色互換)—— 這是後面章節的預告。完全に因果的で安定なシステムであっても、その逆システムは非因果的だったり不安定だったりしうる。$h_i[n]$ の存在と性質は、$z$ 変換を使うとはるかに論じやすくなる(極と零点が役割を入れ替える)——後の章の予告である。

2.6 Chapter Summary2.6 本章總結2.6 本章のまとめ

System properties系統性質システムの性質

Linear: superposition $T\{ax_1+bx_2\}=aT\{x_1\}+bT\{x_2\}$ (zero in → zero out is necessary). Time-invariant: $x[n-n_0]\mapsto y[n-n_0]$. Causal: no future samples. BIBO stable: bounded in → bounded out.

線性:疊加原理 $T\{ax_1+bx_2\}=aT\{x_1\}+bT\{x_2\}$(零輸入必須給出零輸出,是必要條件)。非時變:$x[n-n_0]\mapsto y[n-n_0]$。因果:不使用未來樣本。BIBO 穩定:有界輸入給出有界輸出。

線形:重ね合わせ $T\{ax_1+bx_2\}=aT\{x_1\}+bT\{x_2\}$(ゼロ入力→ゼロ出力は必要条件)。時不変:$x[n-n_0]\mapsto y[n-n_0]$。因果的:未来の標本を使わない。BIBO 安定:有界入力→有界出力。

LTI ⇒ convolutionLTI ⇒ 卷積LTI ⇒ 畳み込み

$x[n]=\sum_k x[k]\delta[n-k]$, so $y[n]=\sum_k x[k]h[n-k]=x[n]*h[n]$. The impulse response $h[n]=T\{\delta[n]\}$ fully characterizes the system.

$x[n]=\sum_k x[k]\delta[n-k]$,因此 $y[n]=\sum_k x[k]h[n-k]=x[n]*h[n]$。脈衝響應 $h[n]=T\{\delta[n]\}$ 完整刻畫了整個系統。

$x[n]=\sum_k x[k]\delta[n-k]$ なので $y[n]=\sum_k x[k]h[n-k]=x[n]*h[n]$。インパルス応答 $h[n]=T\{\delta[n]\}$ がシステムを完全に特徴づける。

Convolution algebra卷積代數畳み込みの代数

Commutative, associative, distributive; $x*\delta[n-n_0]=x[n-n_0]$. Length: $N+M-1$; start index $n_x+n_h$. Matrix view: Toeplitz $H$, $y=Hx$.

滿足交換律、結合律與分配律;$x*\delta[n-n_0]=x[n-n_0]$。長度:$N+M-1$;起始索引:$n_x+n_h$。矩陣觀點:Toeplitz 矩陣 $H$,$y=Hx$。

交換法則・結合法則・分配法則が成り立ち、$x*\delta[n-n_0]=x[n-n_0]$。長さ:$N+M-1$、開始インデックス $n_x+n_h$。行列で見ると Toeplitz 行列 $H$ による $y=Hx$。

Properties via h[n]由 h[n] 判讀性質h[n] から見た性質

Causal ⇔ $h[n]=0,\ n<0$. Stable ⇔ $\sum|h[k]|<\infty$. Cascade: $h_1*h_2$. Parallel: $h_1+h_2$. Inverse: $h*h_i=\delta$.

因果 ⇔ $n<0$ 時 $h[n]=0$。穩定 ⇔ $\sum|h[k]|<\infty$。串聯:$h_1*h_2$。並聯:$h_1+h_2$。反系統:$h*h_i=\delta$。

因果的 ⇔ $h[n]=0,\ n<0$。安定 ⇔ $\sum|h[k]|<\infty$。縦続:$h_1*h_2$。並列:$h_1+h_2$。逆システム:$h*h_i=\delta$。

Exercises習題演習問題

All three problems of ICE503 Homework #2, with full worked solutions.

ICE503 作業 #2 的全部三題,附完整解答。

ICE503 宿題 #2 の全 3 問を、完全な解答つきで掲載する。

Exercise 1 — System properties習題 1 — 系統性質判別演習 1 — システムの性質

Problem: For each of the following systems, determine whether the system is (1) linear, (2) time-invariant, and (3) causal.

題目:對下列各系統,判斷它是否 (1) 線性、(2) 非時變、(3) 因果。

問題:次の各システムについて、(1) 線形か、(2) 時不変か、(3) 因果的か、を判定せよ。

(a) $y[n] = a^2 x[n] - b$,   $a$ and $b$ non-zero constants
(b) $y[n] = x[an-b]$,   $a$ and $b$ non-zero positive constants
(c) $y[n] = \dfrac{1}{M}\Bigl(x[n] + \displaystyle\sum_{k=1}^{(M-1)/2}\bigl(x[n-k]+x[n+k]\bigr)\Bigr)$   ($M$ odd)
(d) $y[n] = \log_2\bigl(\lvert x[n]\rvert\bigr)$

(a) $y[n] = a^2 x[n] - b$,  $a$、$b$ 為非零常數
(b) $y[n] = x[an-b]$,  $a$、$b$ 為非零正常數
(c) $y[n] = \dfrac{1}{M}\Bigl(x[n] + \displaystyle\sum_{k=1}^{(M-1)/2}\bigl(x[n-k]+x[n+k]\bigr)\Bigr)$  ($M$ 為奇數)
(d) $y[n] = \log_2\bigl(\lvert x[n]\rvert\bigr)$

(a) $y[n] = a^2 x[n] - b$、  $a$ と $b$ はゼロでない定数
(b) $y[n] = x[an-b]$、  $a$ と $b$ はゼロでない正の定数
(c) $y[n] = \dfrac{1}{M}\Bigl(x[n] + \displaystyle\sum_{k=1}^{(M-1)/2}\bigl(x[n-k]+x[n+k]\bigr)\Bigr)$  ($M$ は奇数)
(d) $y[n] = \log_2\bigl(\lvert x[n]\rvert\bigr)$

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

(a) $y[n]=a^2x[n]-b$ — not linear; time-invariant; causal.

(a) $y[n]=a^2x[n]-b$ —— 非線性;非時變;因果。

(a) $y[n]=a^2x[n]-b$——線形でない。時不変。因果的。

Linearity: zero input gives $y[n]=-b\neq0$, so the system fails the zero-in/zero-out necessary condition → nonlinear (it is affine). Explicitly, $T\{x_1+x_2\} = a^2(x_1+x_2)-b$ but $T\{x_1\}+T\{x_2\} = a^2(x_1+x_2)-2b$.

線性:零輸入會得到 $y[n]=-b\neq0$,違反「零輸入給出零輸出」這個必要條件 → 非線性(它是仿射系統)。明確寫出來:$T\{x_1+x_2\} = a^2(x_1+x_2)-b$,但 $T\{x_1\}+T\{x_2\} = a^2(x_1+x_2)-2b$。

線形性:入力をゼロにすると $y[n]=-b\neq0$ となり、ゼロ入力→ゼロ出力という必要条件を満たさない → 非線形(アフィンである)。明示的に書けば、$T\{x_1+x_2\} = a^2(x_1+x_2)-b$ である一方、$T\{x_1\}+T\{x_2\} = a^2(x_1+x_2)-2b$ となる。

Time invariance: shifted input $x[n-n_0]$ → $a^2x[n-n_0]-b = y[n-n_0]$. The rule has no explicit dependence on $n$ → time-invariant.

非時變性:把輸入平移成 $x[n-n_0]$ → $a^2x[n-n_0]-b = y[n-n_0]$。這條規則不含 $n$ 的顯式相依 → 非時變。

時不変性:シフトした入力 $x[n-n_0]$ → $a^2x[n-n_0]-b = y[n-n_0]$。規則は $n$ に陽に依存しない → 時不変。

Causality: $y[n]$ uses only $x[n]$ (memoryless) → causal.

因果性:$y[n]$ 只用到 $x[n]$(無記憶)→ 因果。

因果性:$y[n]$ は $x[n]$ しか使わない(無記憶)→ 因果的。

(b) $y[n]=x[an-b]$ — linear; not time-invariant; not causal (in general).

(b) $y[n]=x[an-b]$ —— 線性;非時變不成立;一般而言不因果。

(b) $y[n]=x[an-b]$——線形。時不変でない。(一般には)因果的でない。

Linearity: for input $\alpha x_1+\beta x_2$ the output is $\alpha x_1[an-b]+\beta x_2[an-b] = \alpha y_1[n]+\beta y_2[n]$ → linear (any system that merely re-indexes the input is linear).

線性:輸入 $\alpha x_1+\beta x_2$ 的輸出為 $\alpha x_1[an-b]+\beta x_2[an-b] = \alpha y_1[n]+\beta y_2[n]$ → 線性(任何只對輸入重新索引的系統都是線性的)。

線形性:入力 $\alpha x_1+\beta x_2$ に対する出力は $\alpha x_1[an-b]+\beta x_2[an-b] = \alpha y_1[n]+\beta y_2[n]$ → 線形(入力の添字を付け替えるだけのシステムは必ず線形である)。

Time invariance: shift the input: $w[n]=x[n-n_0]$ gives $T\{w\} = w[an-b] = x[an-b-n_0]$, while the shifted output is $y[n-n_0] = x[a(n-n_0)-b] = x[an-b-an_0]$. These agree for all $x$ only if $an_0=n_0$ for every $n_0$, i.e. only if $a=1$. For a general positive constant $a\neq1$ → not time-invariant (time-scaling re-labels the clock).

非時變性:把輸入平移:$w[n]=x[n-n_0]$ 給出 $T\{w\} = w[an-b] = x[an-b-n_0]$,而平移後的輸出是 $y[n-n_0] = x[a(n-n_0)-b] = x[an-b-an_0]$。兩者對所有 $x$ 都相等的條件是對每個 $n_0$ 都有 $an_0=n_0$,也就是 $a=1$。對一般的正常數 $a\neq1$ → 時變(時間縮放把時鐘重新標號了)。

時不変性:入力をシフトすると、$w[n]=x[n-n_0]$ について $T\{w\} = w[an-b] = x[an-b-n_0]$ となる一方、シフトした出力は $y[n-n_0] = x[a(n-n_0)-b] = x[an-b-an_0]$ である。これらがすべての $x$ について一致するのは、あらゆる $n_0$ で $an_0=n_0$、すなわち $a=1$ のときだけである。一般の正の定数 $a\neq1$ では → 時不変でない(時間軸のスケーリングは時計のラベルを付け替えてしまう)。

Causality: $y[n]$ reads the input at time $an-b$. Causality requires $an-b\le n$, i.e. $(a-1)n\le b$, for every $n$ — impossible for $a>1$ when $n$ grows (e.g. $a=2,b=1$: $y[2]=x[3]$, a future sample) → not causal in general. (In the special case $a=1$ the system is the pure delay $x[n-b]$, $b>0$, which is both time-invariant and causal.)

因果性:$y[n]$ 讀取的是時刻 $an-b$ 的輸入。因果性要求對每一個 $n$ 都有 $an-b\le n$,即 $(a-1)n\le b$——當 $a>1$ 而 $n$ 增大時不可能成立(例如 $a=2,b=1$:$y[2]=x[3]$,用到未來樣本)→ 一般而言不因果。(在 $a=1$ 的特例下,系統就是純延遲 $x[n-b]$、$b>0$,既非時變又因果。)

因果性:$y[n]$ は時刻 $an-b$ の入力を読む。因果性にはあらゆる $n$ について $an-b\le n$、すなわち $(a-1)n\le b$ が必要だが、$a>1$ では $n$ が大きくなると成り立たない(たとえば $a=2,b=1$ なら $y[2]=x[3]$ で未来の標本である)→ 一般には因果的でない。($a=1$ という特別な場合には、このシステムは純粋な遅延 $x[n-b]$、$b>0$ となり、時不変かつ因果的である。)

(c) Centered moving average — linear; time-invariant; not causal.

(c) 置中移動平均 —— 線性;非時變;不因果。

(c) 中心化移動平均——線形。時不変。因果的でない。

Write $y[n] = \frac{1}{M}\sum_{k=-(M-1)/2}^{(M-1)/2} x[n-k]$, a symmetric window of odd length $M$ centered on $n$.

把它寫成 $y[n] = \frac{1}{M}\sum_{k=-(M-1)/2}^{(M-1)/2} x[n-k]$,這是一個以 $n$ 為中心、長度為奇數 $M$ 的對稱窗口。

$y[n] = \frac{1}{M}\sum_{k=-(M-1)/2}^{(M-1)/2} x[n-k]$ と書ける。$n$ を中心とする、長さが奇数 $M$ の対称な窓である。

Linearity: a weighted sum of input samples with constant weights satisfies superposition term by term → linear.

線性:以常數權重對輸入樣本加權求和,逐項都滿足疊加原理 → 線性。

線形性:定数の重みによる入力標本の重み付き和は、項ごとに重ね合わせを満たす → 線形。

Time invariance: replacing $x[\cdot]\to x[\cdot-n_0]$ shifts every term identically: $T\{x[n-n_0]\} = \frac1M\sum_k x[n-n_0-k] = y[n-n_0]$ → time-invariant.

非時變性:把 $x[\cdot]\to x[\cdot-n_0]$ 代入,每一項都平移同樣多:$T\{x[n-n_0]\} = \frac1M\sum_k x[n-n_0-k] = y[n-n_0]$ → 非時變。

時不変性:$x[\cdot]\to x[\cdot-n_0]$ と置き換えると、どの項も同じだけずれる:$T\{x[n-n_0]\} = \frac1M\sum_k x[n-n_0-k] = y[n-n_0]$ → 時不変。

Causality: the terms $x[n+k]$ for $k=1,\dots,(M-1)/2$ are future samples → not causal.

因果性:$k=1,\dots,(M-1)/2$ 的 $x[n+k]$ 各項都是未來樣本 → 不因果。

因果性:$k=1,\dots,(M-1)/2$ の項 $x[n+k]$ は未来の標本である → 因果的でない。

(d) $y[n]=\log_2(|x[n]|)$ — not linear; time-invariant; causal.

(d) $y[n]=\log_2(|x[n]|)$ —— 非線性;非時變;因果。

(d) $y[n]=\log_2(|x[n]|)$——線形でない。時不変。因果的。

Linearity: scaling test: input $\alpha x[n]$ gives $\log_2(|\alpha|\,|x[n]|) = \log_2|\alpha| + \log_2|x[n]| \neq \alpha\,\log_2|x[n]|$ → nonlinear (the log turns scaling into an additive offset).

線性:比例性測試:輸入 $\alpha x[n]$ 得到 $\log_2(|\alpha|\,|x[n]|) = \log_2|\alpha| + \log_2|x[n]| \neq \alpha\,\log_2|x[n]|$ → 非線性(對數把比例縮放變成了相加的位移)。

線形性:スケーリングの判定:入力 $\alpha x[n]$ に対して $\log_2(|\alpha|\,|x[n]|) = \log_2|\alpha| + \log_2|x[n]| \neq \alpha\,\log_2|x[n]|$ → 非線形(対数はスケーリングを加法的なオフセットに変えてしまう)。

Time invariance: the rule is a fixed memoryless nonlinearity, independent of $n$: shifted input → shifted output → time-invariant.

非時變性:這條規則是固定的無記憶非線性映射,與 $n$ 無關:輸入平移 → 輸出平移 → 非時變。

時不変性:この規則は $n$ に依存しない、固定された無記憶の非線形性である。入力をシフトすれば出力もシフトする → 時不変。

Causality: depends only on $x[n]$ → causal.

因果性:只取決於 $x[n]$ → 因果。

因果性:$x[n]$ だけに依存する → 因果的。

SystemLinearTime-invariantCausal
(a) $a^2x[n]-b$NoYesYes
(b) $x[an-b]$YesNo (unless $a{=}1$)No (unless $a{=}1$)
(c) centered MAYesYesNo
(d) $\log_2|x[n]|$NoYesYes
系統線性非時變因果
(a) $a^2x[n]-b$否是是
(b) $x[an-b]$是否(除非 $a{=}1$)否(除非 $a{=}1$)
(c) 置中移動平均是是否
(d) $\log_2|x[n]|$否是是
システム線形時不変因果的
(a) $a^2x[n]-b$いいえはいはい
(b) $x[an-b]$はいいいえ($a{=}1$ を除く)いいえ($a{=}1$ を除く)
(c) 中心化移動平均はいはいいいえ
(d) $\log_2|x[n]|$いいえはいはい
Exercise 2 — Linear or nonlinear?習題 2 — 線性還是非線性?演習 2 — 線形か非線形か

Problem: The system $T$ is known to be time-invariant. When the inputs are $x_1[n]$, $x_2[n]$, $x_3[n]$, the responses are $y_1[n]$, $y_2[n]$, $y_3[n]$ (Figure 1 of the homework):

題目:已知系統 $T$ 是非時變的。當輸入為 $x_1[n]$、$x_2[n]$、$x_3[n]$ 時,對應的響應分別是 $y_1[n]$、$y_2[n]$、$y_3[n]$(作業的圖 1):

問題:システム $T$ は時不変であることが分かっている。入力が $x_1[n]$、$x_2[n]$、$x_3[n]$ のとき、応答はそれぞれ $y_1[n]$、$y_2[n]$、$y_3[n]$ であった(宿題の図 1):

$$\begin{aligned} x_1[n] &= \delta[n] + 2\,\delta[n-1] &&\longrightarrow& y_1[n] &= 2\,\delta[n-1] + 3\,\delta[n-2]\\ x_2[n] &= 2\,\delta[n-1] &&\longrightarrow& y_2[n] &= 2\,\delta[n-2] + 4\,\delta[n-3]\\ x_3[n] &= \delta[n-4] &&\longrightarrow& y_3[n] &= 3\,\delta[n+2] + 2\,\delta[n+1] \end{aligned}$$

Determine whether the system $T$ is linear or nonlinear.

請判斷系統 $T$ 是線性還是非線性。

システム $T$ が線形か非線形かを判定せよ。

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

Strategy: assume $T$ is linear, combine that assumption with the given fact that $T$ is time-invariant, and look for a contradiction among the three input–output pairs.

策略:先假設 $T$ 是線性的,把這個假設與題目給定的「$T$ 非時變」合起來用,然後在三組輸入輸出對之間找矛盾。

方針:$T$ が線形であると仮定し、それを「$T$ は時不変である」という与えられた事実と組み合わせて、3 組の入出力の間に矛盾を探す。

Step 1 — relate the inputs. Notice that $$x_1[n] = \delta[n] + 2\,\delta[n-1] = \delta[n] + x_2[n].$$ If $T$ were linear (additivity), the response to $\delta[n]$ would have to be $$h[n] \;=\; T\{\delta[n]\} \;=\; y_1[n] - y_2[n] = 2\delta[n-1] + 3\delta[n-2] - 2\delta[n-2] - 4\delta[n-3] = 2\delta[n-1] + \delta[n-2] - 4\delta[n-3].$$

第 1 步 —— 把輸入彼此關聯起來。注意到 $$x_1[n] = \delta[n] + 2\,\delta[n-1] = \delta[n] + x_2[n].$$ 如果 $T$ 是線性的(可加性),那麼對 $\delta[n]$ 的響應必須是 $$h[n] \;=\; T\{\delta[n]\} \;=\; y_1[n] - y_2[n] = 2\delta[n-1] + 3\delta[n-2] - 2\delta[n-2] - 4\delta[n-3] = 2\delta[n-1] + \delta[n-2] - 4\delta[n-3].$$

手順 1 — 入力どうしを関係づける。次に注目する: $$x_1[n] = \delta[n] + 2\,\delta[n-1] = \delta[n] + x_2[n].$$ もし $T$ が線形(加法的)なら、$\delta[n]$ に対する応答は $$h[n] \;=\; T\{\delta[n]\} \;=\; y_1[n] - y_2[n] = 2\delta[n-1] + 3\delta[n-2] - 2\delta[n-2] - 4\delta[n-3] = 2\delta[n-1] + \delta[n-2] - 4\delta[n-3].$$ でなければならない。

Step 2 — invoke time invariance. $T$ is time-invariant, so the response to $x_3[n] = \delta[n-4]$ would have to be $h[n-4]$: $$T\{\delta[n-4]\} = 2\,\delta[n-5] + \delta[n-6] - 4\,\delta[n-7],$$ a sequence supported on $n = 5, 6, 7$.

第 2 步 —— 用上非時變性。$T$ 是非時變的,所以對 $x_3[n] = \delta[n-4]$ 的響應必須是 $h[n-4]$: $$T\{\delta[n-4]\} = 2\,\delta[n-5] + \delta[n-6] - 4\,\delta[n-7],$$ 這是一條支撐在 $n = 5, 6, 7$ 的序列。

手順 2 — 時不変性を使う。$T$ は時不変なので、$x_3[n] = \delta[n-4]$ に対する応答は $h[n-4]$ でなければならない: $$T\{\delta[n-4]\} = 2\,\delta[n-5] + \delta[n-6] - 4\,\delta[n-7],$$ これは $n = 5, 6, 7$ を台にもつ系列である。

Step 3 — compare with the measured response. The actual response is $$y_3[n] = 3\,\delta[n+2] + 2\,\delta[n+1],$$ supported on $n = -2, -1$. The two disagree completely → contradiction.

第 3 步 —— 與實測響應比較。實際的響應是 $$y_3[n] = 3\,\delta[n+2] + 2\,\delta[n+1],$$ 支撐在 $n = -2, -1$。兩者完全不一致 → 矛盾。

手順 3 — 実測の応答と比べる。実際の応答は $$y_3[n] = 3\,\delta[n+2] + 2\,\delta[n+1],$$ であり、台は $n = -2, -1$ である。両者はまったく一致しない → 矛盾。

$$\boxed{\text{The system } T \text{ is nonlinear.}}$$

Cross-check (independent contradiction). Since $x_2[n] = 2\,\delta[n-1] = 2\,x_3[n+3]$: by time invariance the response to $x_3[n+3]$ is $y_3[n+3] = 3\delta[n+5]+2\delta[n+4]$; if $T$ were also linear (homogeneity) we would need $y_2[n] = 2\,y_3[n+3] = 6\,\delta[n+5] + 4\,\delta[n+4]$. But the measured $y_2[n] = 2\delta[n-2]+4\delta[n-3]$ — again a contradiction, confirming nonlinearity.

交叉驗證(另一個獨立的矛盾)。因為 $x_2[n] = 2\,\delta[n-1] = 2\,x_3[n+3]$:由非時變性,對 $x_3[n+3]$ 的響應是 $y_3[n+3] = 3\delta[n+5]+2\delta[n+4]$;若 $T$ 同時是線性的(齊次性),則必須有 $y_2[n] = 2\,y_3[n+3] = 6\,\delta[n+5] + 4\,\delta[n+4]$。但實測的 $y_2[n] = 2\delta[n-2]+4\delta[n-3]$ —— 又是一個矛盾,確認系統非線性。

別ルートでの確認(独立な矛盾)。$x_2[n] = 2\,\delta[n-1] = 2\,x_3[n+3]$ であるから、時不変性により $x_3[n+3]$ に対する応答は $y_3[n+3] = 3\delta[n+5]+2\delta[n+4]$ である。もし $T$ が線形(斉次的)でもあるなら $y_2[n] = 2\,y_3[n+3] = 6\,\delta[n+5] + 4\,\delta[n+4]$ でなければならない。しかし実測は $y_2[n] = 2\delta[n-2]+4\delta[n-3]$ であり、ここでも矛盾する。非線形であることが裏づけられた。

Remark: note the logic direction — the data can disprove linearity, but no finite set of input–output pairs could ever prove it.

附註:請留意論證的方向——這些資料可以推翻線性,但任何有限多組輸入輸出對都無法證明線性。

注意:論理の向きに注意せよ——データは線形性を反証できるが、有限個の入出力の組がそれを証明することは決してできない。

Exercise 3 — MATLAB: 5-point moving average習題 3 — MATLAB:5 點移動平均演習 3 — MATLAB:5 点移動平均

Problem: The input signal is $$x[n] = \delta[n] + 3\,\delta[n-1] + 7\,\delta[n-2] + 2\,\delta[n-3] + 4\,\delta[n-4]$$ and the output of a 5-point moving average is $$y[n] = \frac{1}{5}\sum_{k=0}^{4} x[n-k].$$ (a) Use the stem function to plot $x[n]$. (b) Use a for loop to calculate $y[n]$. (c) Use the convolution function to calculate $y[n]$ (results of (b) and (c) must agree). (d) Use stem to plot $y[n]$.

題目:輸入訊號為 $$x[n] = \delta[n] + 3\,\delta[n-1] + 7\,\delta[n-2] + 2\,\delta[n-3] + 4\,\delta[n-4]$$ 而 5 點移動平均的輸出為 $$y[n] = \frac{1}{5}\sum_{k=0}^{4} x[n-k].$$ (a) 用 stem 函式畫出 $x[n]$。 (b) 用 for 迴圈計算 $y[n]$。 (c) 用卷積函式計算 $y[n]$((b) 與 (c) 的結果必須一致)。 (d) 用 stem 畫出 $y[n]$。

問題:入力信号を $$x[n] = \delta[n] + 3\,\delta[n-1] + 7\,\delta[n-2] + 2\,\delta[n-3] + 4\,\delta[n-4]$$ とし、5 点移動平均の出力を $$y[n] = \frac{1}{5}\sum_{k=0}^{4} x[n-k].$$ とする。(a) stem 関数で $x[n]$ を描け。(b) for ループで $y[n]$ を計算せよ。(c) 畳み込み関数で $y[n]$ を計算せよ((b) と (c) の結果は一致しなければならない)。(d) stem で $y[n]$ を描け。

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

Setup. The input vector is $x = [1\;3\;7\;2\;4]$ on $n=0,\dots,4$ ($N=5$) and the filter is the FIR impulse response $h[n]=\frac15$ for $0\le n\le4$ ($M=5$). The output has length $N+M-1 = 9$, on $n = 0,\dots,8$.

設定。輸入向量是 $n=0,\dots,4$ 上的 $x = [1\;3\;7\;2\;4]$($N=5$),濾波器是 FIR 脈衝響應 $h[n]=\frac15$($0\le n\le4$,$M=5$)。輸出長度為 $N+M-1 = 9$,落在 $n = 0,\dots,8$。

準備。入力ベクトルは $n=0,\dots,4$ 上の $x = [1\;3\;7\;2\;4]$($N=5$)であり、フィルタは $0\le n\le4$ で $h[n]=\frac15$ となる FIR のインパルス応答である($M=5$)。出力の長さは $N+M-1 = 9$ で、$n = 0,\dots,8$ にわたる。

clc; clear; close all;

n = 0:4;                       % time index of the input
x = [1 3 7 2 4];               % x[n] sample values
N = length(x);                 % input length
M = 5;                         % moving-average length

%% (a) plot x[n] with stem
figure(1)
stem(n, x, 'filled');
xlabel('n'); ylabel('x[n]');
title('Input signal x[n]');
grid on;

%% (b) compute y[n] with a for loop
x_padded = [x zeros(1, M-1)];  % zero-pad to handle the boundary
y_loop = zeros(1, N + M - 1);  % preallocate the output

for i = 1:(N + M - 1)          % loop over output samples
    sum_val = 0;
    for k = 0:(M - 1)          % accumulate the M-sample window
        if (i - k) > 0         % keep the index valid (x[n]=0 for n<0)
            sum_val = sum_val + x_padded(i - k);
        end
    end
    y_loop(i) = sum_val / M;   % the average
end

%% (c) compute y[n] with conv
h = (1/M) * ones(1, M);        % MA impulse response h[n] = 1/5, n = 0..4
y_conv = conv(x, h);           % identical to y_loop

%% (d) plot y[n] with stem
n_out = 0:(N + M - 2);         % output time index, length N+M-1

figure(2)
subplot(2,1,1)
stem(n_out, y_loop, 'filled');
xlabel('n'); ylabel('y[n]');
title('Output y[n] (for loop)');
grid on;

subplot(2,1,2)
stem(n_out, y_conv, 'filled');
xlabel('n'); ylabel('y[n]');
title('Output y[n] (conv)');
grid on;

Hand check (and program output). $y[n] = \frac15\,(x*\mathbf{1}_5)[n]$: each output is the sum of the (at most five) input samples in the window $n-4,\dots,n$, divided by 5:

手算驗證(也就是程式的輸出)。$y[n] = \frac15\,(x*\mathbf{1}_5)[n]$:每一個輸出都是窗口 $n-4,\dots,n$ 內(至多五個)輸入樣本的總和除以 5:

手計算での確認(およびプログラムの出力)。$y[n] = \frac15\,(x*\mathbf{1}_5)[n]$:各出力は、窓 $n-4,\dots,n$ に入る(最大 5 個の)入力標本の和を 5 で割ったものである:

$n$012345678
window sum14111317161364
$y[n]$0.20.82.22.63.43.22.61.20.8
$n$012345678
窗口總和14111317161364
$y[n]$0.20.82.22.63.43.22.61.20.8
$n$012345678
窓内の和14111317161364
$y[n]$0.20.82.22.63.43.22.61.20.8

The loop and conv give exactly the same vector, as required — the nested loop literally evaluates the convolution sum $y[n]=\sum_k h[k]\,x[n-k]$ that conv implements. Sanity checks from §2.4.4: length $5+5-1=9$ ✓; first sample $y[0]=x[0]h[0]=0.2$ ✓; $\sum_n y[n] = 17\cdot1 = 17$, and indeed $\sum x = 17$, $\sum h = 1$ ✓.

迴圈與 conv 給出完全相同的向量,正如題目要求——巢狀迴圈其實就是逐字地在計算 conv 所實作的那個卷積和 $y[n]=\sum_k h[k]\,x[n-k]$。用 §2.4.4 的檢查法驗算:長度 $5+5-1=9$ ✓;首樣本 $y[0]=x[0]h[0]=0.2$ ✓;$\sum_n y[n] = 17\cdot1 = 17$,而確實 $\sum x = 17$、$\sum h = 1$ ✓。

ループと conv は要求どおりまったく同じベクトルを与える——入れ子のループは、conv が実装している畳み込み和 $y[n]=\sum_k h[k]\,x[n-k]$ を文字どおり評価しているからである。§2.4.4 の検算:長さ $5+5-1=9$ ✓、最初の標本 $y[0]=x[0]h[0]=0.2$ ✓、$\sum_n y[n] = 17\cdot1 = 17$ で、実際 $\sum x = 17$、$\sum h = 1$ ✓。

2026-06-12T22:22:28.006969 image/svg+xml Matplotlib v3.10.8, https://matplotlib.org/ 0 2 4 6 8 0 2 4 6 x[n] Input x[n] 0 2 4 6 8 n 0 1 2 3 y[n] Output y[n] of the 5-point moving average (loop = conv)
Fig. 2-6 — The result of Homework 2, Problem 3, regenerated: the input x[n] = {1,3,7,2,4} (top) and the 5-point moving-average output y[n] (bottom). The for-loop and the conv result coincide exactly.
圖 2-6 — 重新產生的作業 2 第 3 題結果:上為輸入 x[n] = {1,3,7,2,4},下為 5 點移動平均的輸出 y[n]。for 迴圈與 conv 的結果完全相同。
図 2-6 — 宿題 2 の問題 3 の結果を再現したもの:入力 x[n] = {1,3,7,2,4}(上)と、5 点移動平均の出力 y[n](下)。for ループの結果と conv の結果は完全に一致する。