A signal(訊號) is an information-bearing function — a function of one or more independent variables (usually time) that carries information about the behavior or nature of some phenomenon. Speech waveforms, ECG traces, stock prices, seismic records, and images are all signals. Signal processing(訊號處理) is the set of operations we apply to a signal to extract, enhance, store, or transmit the useful information it carries — for example removing noise, separating mixed signals, measuring a frequency, or compressing data.
Three levels of "discreteness" must be distinguished:
| Type | Time axis | Amplitude axis | Notation |
|---|---|---|---|
| Continuous-time(連續時間)= analog | continuous, all $t$ | continuous | $x(t)$, parentheses |
| Discrete-time(離散時間) | discrete instants, integer $n$ | continuous | $x[n]$, brackets |
| Digital(數位) | discrete | discrete (quantized) | $x[n]$ with finite word length |
A discrete-time signal takes values only at discrete time indices; a digital signal is discrete in both time and amplitude (each sample is quantized to a finite number of bits). In analysis we usually work with ideal discrete-time signals and treat quantization separately.
An analog processor maps $x(t)$ directly to $y(t)$ with physical circuits (R, L, C, op-amps). Digital processing of an analog signal inserts a conversion sandwich: an A/D converter (類比轉數位轉換器) samples and quantizes $x(t)$ into $x[n]$, a digital processor computes $y[n]$ numerically, and a D/A converter reconstructs the analog output $y(t)$.
Historical thread from the lecture: numerical methods for continuous-variable problems date to the 17th century; large digital computers became available in the 1950s (initially to simulate analog systems before building them); by the 1960s researchers recognized digital signal processing as a separate field in its own right.
| Advantages of digital(優點) | Disadvantages(缺點) |
|---|---|
| Insensitive to component tolerances; fairly independent of temperature, aging, and other external parameters | Higher system complexity: needs pre/post-processing devices (A/D and D/A converters, anti-aliasing filters) |
| Easily reproduced — no per-unit adjustment or tuning | Power consumption of converters and processors |
| Amenable to full integration: a highly complex DSP system fits on a single VLSI chip | Limited range of frequencies available for processing (set by the achievable sampling rate) |
| Programmable and reconfigurable; exact repeatability; easy storage | Quantization and finite word-length effects introduce errors |
A discrete-time signal is a sequence(序列) of numbers $x = \{x[n]\}$, $-\infty < n < \infty$, with integer index $n$. Most sequences in practice come from uniform sampling(均勻取樣) of an analog signal:
A finite-length (N-point) sequence is defined on $N_1 \le n \le N_2$ with length $N = N_2 - N_1 + 1$; sample values may be real or complex. We often write a short sequence by listing its values with an arrow or underline marking $n=0$, e.g. $x[n]=\{1, \underline{2}, 1, 1\}$ means $x[-1]=1,\ x[0]=2,\ x[1]=1,\ x[2]=1$.
All basic operations act sample by sample:
| Operation | Definition | Note |
|---|---|---|
| Addition(相加) | $y[n] = x[n] + w[n]$ | sample-by-sample sum |
| Product / modulation(調變) | $y[n] = x[n]\cdot w[n]$ | basis of windowing and modulation |
| Scalar multiplication(純量倍乘) | $y[n] = A\,x[n]$ | gain $A$ |
| Time shift(時間平移) | $y[n] = x[n-N]$ | $N>0$: delay(延遲), $N<0$: advance(超前) |
| Time reversal / folding(翻轉) | $y[n] = x[-n]$ | mirror about $n=0$ |
| Branching | one signal feeds several blocks | used in block diagrams |
Operations are often combined, e.g. $y[n] = x[2n-3]$ or $y[n] = x[3-n]$. The safe way to evaluate a combination is substitution: for each output index $n$, compute the argument and read off the input sample.
Sampling-rate alteration changes the time scale of a sequence.
Down-sampling throws away samples — information can be permanently lost (this is exactly the aliasing issue of Section 1.3.5). Up-sampling only inserts zeros, so no information is lost; the zeros are later filled by an interpolation filter (Chapter on multirate DSP).
Complex numbers(複數)are a mathematical convenience that leads to simple expressions for sinusoids and frequency responses. A second "imaginary" dimension ($j = \sqrt{-1}$, $j^2 = -1$) is added to all values.
Practical rules: add/subtract in rectangular form (componentwise), multiply/divide in polar form (magnitudes multiply, phases add): $z_1 z_2 = |z_1||z_2|\,e^{j(\theta_1+\theta_2)}$.
abs(z), angle(z), real(z), imag(z),
conj(z), and exp(1j*theta) implement everything above. Remember
1j (or 1i) — a bare j may have been overwritten by a loop variable.
For a real sequence:
For a complex sequence the natural generalizations are:
Every sequence can be decomposed uniquely into these two parts:
For real sequences this reduces to the even–odd decomposition(偶奇分解) $x[n] = x_{ev}[n] + x_{od}[n]$ with $x_{ev}[n] = \tfrac12 (x[n] + x[-n])$ and $x_{od}[n] = \tfrac12 (x[n] - x[-n])$.
Two building blocks generate everything else.
They are related by a running sum and a first difference:
The most important identity of the whole course: any sequence is a weighted sum of shifted impulses — this is what will make convolution work in Chapter 2.
With complex $A = |A|e^{j\phi}$ and $\alpha = |\alpha|e^{j\omega_0}$, the complex exponential sequence(複指數序列) combines both:
For $|\alpha| = 1$ this is the pure complex exponential $e^{j\omega_0 n}$ — the eigenfunction of every LTI system and the basis of all Fourier analysis to come.
A sequence is periodic(週期性) with period $N$ (a positive integer) if $x[n] = x[n+N]$ for all $n$; the smallest such $N$ is the fundamental period(基本週期). Unlike continuous time, a discrete sinusoid is not automatically periodic:
i.e. $x[n] = \cos(\omega_0 n + \phi)$ is periodic iff $\omega_0 / 2\pi$ is a rational number. Writing $\omega_0/2\pi = k/N$ in lowest terms, the fundamental period is $N$. For example $\cos(0.25\pi n)$ has $\omega_0/2\pi = 1/8$, so $N = 8$; but $\cos(n)$ ($\omega_0 = 1$, $\omega_0/2\pi = 1/2\pi$ irrational) is never periodic.
Periodic complex exponentials. For period $N$, the harmonically related complex exponentials are $e^{j2\pi k n / N}$, $k \in \mathbb{Z}$ — but only $N$ of them are distinct, since $k$ and $k+N$ give the identical sequence. This finiteness is what makes the DFS/DFT possible.
★ Important — Symmetry of periodic sequences(重要). For a period-$N$ sequence, symmetry is defined modulo $N$: $x[n]$ is periodic conjugate-symmetric if $x[n] = x^{*}[\langle -n\rangle_N]$, where $\langle m \rangle_N$ denotes $m$ modulo $N$. The decomposition of Section 1.3.1 carries over with $-n$ replaced by $\langle -n\rangle_N$.
Sample the analog sinusoid $x_a(t) = \cos(\Omega_0 t)$ at rate $f_s = 1/T$:
Now combine this with the $2\pi$-ambiguity of discrete frequency: analog frequencies $f_0$ and $f_0 + k f_s$ (any integer $k$), and also $-f_0 + k f_s$, all map to the same sample sequence. Distinct analog sinusoids become indistinguishable after sampling — this is aliasing(混疊).
Three more classes used constantly in stability arguments:
| Class | Condition | Why it matters |
|---|---|---|
| Bounded(有界) | $|x[n]| \le B_x < \infty \;\; \forall n$ | the "B" in BIBO stability |
| Absolutely summable(絕對可和) | $\sum_{n=-\infty}^{\infty} |x[n]| < \infty$ | guarantees DTFT exists; BIBO criterion for $h[n]$ |
| Square summable(平方可和) | $\sum_{n=-\infty}^{\infty} |x[n]|^2 < \infty$ | finite energy |
Analog $x(t)$: continuous in time and amplitude. Discrete-time $x[n]$: integer $n$ only. Digital: discrete in both. DSP chain: A/D → digital processor → D/A.
$\delta[n]$, $u[n] = \sum_{m\le n}\delta[m]$, $\delta[n]=u[n]-u[n-1]$, exponential $A\alpha^n$, sinusoid $A\cos(\omega_0 n + \phi)$, and the sifting identity $x[n]=\sum_k x[k]\delta[n-k]$.
Shift $x[n-N]$, flip $x[-n]$, scale $Ax[n]$, modulate $x[n]w[n]$, down-sample $x[nM]$, up-sample (insert $L-1$ zeros). Evaluate combinations by substituting indices.
$\cos(\omega_0 n)$ periodic $\iff \omega_0/2\pi = k/N$ rational; fundamental period $N$ from lowest terms. $\omega_0$ and $\omega_0 + 2\pi r$ are the same frequency.
$x_{cs}[n] = \tfrac12(x[n]+x^{*}[-n])$, $x_{ca}[n] = \tfrac12(x[n]-x^{*}[-n])$; unique split, real case = even + odd.
$E=\sum|x|^2$, $P=\lim \frac{1}{2K+1}\sum|x|^2$; energy signals have $P=0$, periodic signals are power signals. Sampling maps $\omega_0 = 2\pi f_0/f_s$; $f_0$ and $f_0 + kf_s$ alias.
All three problems of ICE503 DSP Homework #1, with full worked solutions.
Problem: A discrete-time system produces the output sequence
$$y[n] = 3x[n] + 5x[n-1] + 4x[n-2] + 8x[n-4] + x[n-5].$$(a) Plot the block diagram for this system.
(b) The input $x[n]$ shown below is $x[-1]=1$, $x[0]=2$, $x[1]=1$, $x[2]=1$ (zero elsewhere). Sketch and label $y[n]$.
(c) Following (b), sketch and label the down-sampled sequence $y[3n]$.
(d) Following (b), sketch and label the up-sampled sequence $y\!\left[\tfrac{1}{2}n\right]$.
(a) Block diagram. The system is a tapped delay line(分接延遲線): five unit delays $z^{-1}$ in cascade, taps at $x[n], x[n-1], x[n-2], x[n-4], x[n-5]$ with gains $3, 5, 4, 8, 1$, all summed. Note there is no tap after the third delay (the $x[n-3]$ coefficient is 0), but the delay itself must still be present to reach $x[n-4]$ and $x[n-5]$.
(b) Output $y[n]$. Since the system is a weighted sum of delayed inputs, slide the coefficient set $\{3,5,4,0,8,1\}$ (at delays $0\ldots5$) over the input. With $x[-1]=1, x[0]=2, x[1]=1, x[2]=1$:
(c) Down-sampling $y[3n]$. Keep every third sample of $y$: $y[3\cdot 0] = y[0] = 11$, $\; y[3\cdot 1] = y[3] = 17$, $\; y[3\cdot 2] = y[6] = 9$; for $n \le -1$, $y[3n] = y[-3], y[-6], \ldots = 0$ and for $n \ge 3$, $y[9] = 0$. So
(d) Up-sampling $y[n/2]$. Defined only when $n/2$ is an integer; odd $n$ gives 0:
i.e. the samples of $y$ spread to even indices $n = 2m$ with zeros in between ($y_u[-2]=3$, $y_u[0]=11$, $y_u[2]=17$, $y_u[4]=16$, $y_u[6]=17$, $y_u[8]=21$, $y_u[10]=10$, $y_u[12]=9$, $y_u[14]=1$).
Problem: Determine whether each of the following signals is periodic. If periodic, state its fundamental period.
(a) $x[n] = 2\cos\left(\dfrac{\pi}{2} n\right)$ (b) $x[n] = n \sin\left(\dfrac{\pi}{4} n\right)$ (c) $x[n] = e^{\,j \frac{3}{5}\pi n}$
(a) $\omega_0 = \dfrac{\pi}{2}$, so $\dfrac{\omega_0}{2\pi} = \dfrac{1}{4} = \dfrac{k}{N}$ — rational, already in lowest terms with $k=1$, $N=4$.
(b) The sinusoidal factor $\sin(\pi n/4)$ alone would have period 8, but the amplitude factor $n$ grows without bound. Suppose $x[n]$ were periodic with some period $N>0$. Look at the indices $n = 2, 2+8, 2+16, \dots$ where $\sin(\pi n /4) = \sin(\pi/2 + 2\pi m) = 1$: there $x[2] = 2$, $x[10] = 10$, $x[18] = 18, \dots$ — the values keep growing, so no value can ever repeat with any period. (Equivalently: a periodic sequence must be bounded, but $|x[8m+2]| = 8m+2 \to \infty$.)
(c) $\omega_0 = \dfrac{3\pi}{5}$, so $\dfrac{\omega_0}{2\pi} = \dfrac{3}{10} = \dfrac{k}{N}$ — rational, lowest terms $k = 3$, $N = 10$. The sequence completes $3$ full revolutions of the unit circle every $10$ samples.
Problem: MATLAB simulation:
(a) Generate the complex-valued signal
$$x[n] = e^{\,j\frac{1}{10}\pi n}, \qquad n = -10, \dots, -1, 0, 1, \dots, 10.$$
(b) Use the stem function to plot the real part and the imaginary part of $x[n]$.
(c) Determine whether $x[n]$ is a conjugate-symmetric or a conjugate-antisymmetric sequence, and explain the reason.
(a)–(b) MATLAB code.
% Homework 1, Problem 3
n = -10:10;
x = exp(1j*pi*n/10); % x[n] = e^{j*pi*n/10}
figure;
subplot(2,1,1);
stem(n, real(x), 'filled');
xlabel('n'); ylabel('Re\{x[n]\}'); grid on;
title('Real part of x[n] = e^{j\pi n/10}');
subplot(2,1,2);
stem(n, imag(x), 'filled');
xlabel('n'); ylabel('Im\{x[n]\}'); grid on;
title('Imaginary part of x[n]');
% (c) numerical check of conjugate symmetry: compare x[n] with x*[-n]
xflip = conj(fliplr(x)); % x*[-n] on the same index grid
max(abs(x - xflip)) % returns 0 -> conjugate symmetric
(c) Conjugate symmetric. Test the definition $x[n] \stackrel{?}{=} x^{*}[-n]$:
Since $x[n] = x^{*}[-n]$ for every $n$, the sequence is conjugate symmetric(共軛對稱), not conjugate antisymmetric. Equivalently, by Euler's formula $x[n] = \cos(\pi n/10) + j\sin(\pi n /10)$: the real part $\cos(\pi n/10)$ is an even function of $n$ and the imaginary part $\sin(\pi n/10)$ is an odd function of $n$ — exactly the requirement for conjugate symmetry (visible in Fig. 1-9). A further consistency check: $x[0] = e^{0} = 1$ is purely real, as conjugate symmetry demands ($x[0] = x^{*}[0]$), whereas a conjugate-antisymmetric sequence would require $x[0]$ to be purely imaginary.