Digital Signal Processing 2 Les 2: Inleiding 2
Prof. dr. ir. Toon van Waterschoot Faculteit Industriële Ingenieurswetenschappen ESAT – Departement Elektrotechniek KU Leuven, Belgium
Digital Signal Processing 2: Vakinhoud • • • • • • • • • • • •
Les 1: Inleiding 1 (Discrete signalen en systemen) Les 2: Inleiding 2 (Wiskundige concepten) Les 3: Spectrale analyse Les 4: Elementair filterontwerp Les 5: Schattingsproblemen Les 6: Lineaire predictie Les 7: Optimale filtering Les 8: Adaptieve filtering Les 9: Detectieproblemen Les 10: Classificatieproblemen Les 11: Codering Les 12: Herhalingsles
Les 2: Inleiding 2 • Complex number theory complex numbers, complex plane, complex sinusoids, circular motion, sinusoidal motion, …
• Signal transforms z-transform, Fourier transform, discrete Fourier transform
• Matrix algebra vectors, matrices, linear systems of equations
Les 2: Literatuur • Complex number theory J. O. Smith III, Mathematics of the DFT - Ch. 2, “Introduction to Complex Numbers” - Ch. 4, Section 4.2, “Complex Sinusoids”
• Signal transforms S. J. Orfanidis, Introduction to Signal Processing - Ch. 5, “z-Transforms” - Ch. 9, “DFT/FFT Algorithms” M. H. Hayes, Statistical Digital Signal Processing and Modeling - [summary] Ch. 2, Sections 2.2.4, 2.2.5, 2.2.8
• Matrix algebra M. H. Hayes, Statistical Digital Signal Processing and Modeling - Ch. 2, Section 2.3, “Linear Algebra”
Les 2: Inleiding 2 • Complex number theory complex numbers, complex plane, complex sinusoids, circular motion, sinusoidal motion, …
• Signal transforms z-transform, Fourier transform, discrete Fourier transform
• Matrix algebra vectors, matrices, linear systems of equations
Complex number theory • Complex numbers - - - -
roots of a quadratic polynomial equation fundamental theorem of algebra complex numbers complex plane
• Complex sinusoids - - - -
complex numbers ª complex sinusoids circular motion positive and negative frequencies sinusoidal motion
Complex numbers (1)
complex numbers? “imaginary” roots of a polynomial equation
Complex numbers (2) • roots of a quadratic polynomial equation: -
consider a quadratic polynomial, describing a parabola:
p(x) = ax2 + bx + c (a > 0) -
the roots of the polynomial correspond to the points where the parabola crosses the horizontal x-axis 2
ax + bx + c = 0 , x1,2 =
b±
p
b2 2a
4ac
Complex numbers (3)
p(x)
• roots of a quadratic polynomial equation: -
-
-
2
if b 4ac > 0 the polynomial has 2 real roots, and the parabola has 2 distinct intercepts with the x-axis if b2 4ac = 0 the polynomial has 1 real root (with multiplicity 2), and the parabola has 1 intercept (tangent point) with the x-axis 2 if b 4ac < 0 the polynomial has no real roots, and the parabola has no intercepts with the x-axis
x p(x)
x p(x)
x
Complex numbers (4) • roots of a quadratic polynomial equation: -
-
alternatively, if b2 4ac < 0 we could say that the polynomial has 2 “imaginary roots”, and the parabola has 2 “imaginary” intercepts with the x-axis these imaginary roots are represented as complex numbers:
x1,2 =
b±j
with
j,
p
p
(b2 2a
4ac) p(x)
1 x
Complex numbers (5) fundamental theorem of algebra:
every n-th order polynomial has exactly n complex roots
p(x)
= =
an xn + an 1 xn n Y an (x xi )
1
+ . . . + a1 x + a0
i=1
ai 2 R, x, xi 2 C
Complex numbers (6) • complex numbers: -
complex number:
x = |{z} a + jb |{z} Re
-
complex conjugate:
-
modulus:
-
argument:
p
x ¯=a
with a, b 2 R
Im
jb
p
a2 + b2 = x¯ x ✓ ◆ b \x = arctan a
|x| =
• complex field: -
the complex numbers form a field, and all algebraic rules for real numbers also apply for complex numbers
Complex numbers (7) • complex plane: x = a + jb -
the modulus and argument naturally lead to a radial representation in the complex plane
p r , |x| = a2 + ✓ b2 ◆ b ✓ , \x = arctan a Im
jb
complex plane
r
a = r cos ✓ b = r sin ✓
✓ a
Re
Complex number theory • Complex numbers - - - -
roots of a quadratic polynomial equation fundamental theorem of algebra complex numbers complex plane
• Complex sinusoids - - - -
complex numbers ª complex sinusoids circular motion positive and negative frequencies sinusoidal motion
Complex sinusoids (1) • complex variable ➙ complex sinusoid: -
from the radial representation we obtain
x = a + jb = r(cos ✓ + j sin ✓) -
replacing
✓ = !k
x[k] = r(cos !k + j sin !k) -
using Euler’s identity we get
x[k] = rej!k = r(cos !k + j sin !k)
Complex sinusoids (2) • circular motion: -
a complex sinusoid can be seen as a vector which describes a circular trajectory in the z-plane
x[k] = rej!k = r(cos !k + j sin !k) Im
z-plane
r
rej!k !k
r r
r
Re
Complex sinusoids (3) • positive and negative frequencies: -
-
for positive frequencies ! > 0 the circular motion is in counterclockwise direction for negative frequencies ! < 0 the circular motion is in clockwise direction Im
!>0
r
re !k
r r
Im
z-plane
r
r
j!k
Re
z-plane
rej!k !k
r r
r
Re
Complex sinusoids (4) • sinusoidal motion: -
sinusoidal motion is the projection of circular motion onto any straight line in the z-plane, e.g., j!k • r cos !k is the projection of re onto the Re-axis • r sin !k is the projection of rej!k onto the Im-axis
Im
Re
k
Les 2: Inleiding 2 • Complex number theory complex numbers, complex plane, complex sinusoids, circular motion, sinusoidal motion, …
• Signal transforms z-transform, Fourier transform, discrete Fourier transform
• Matrix algebra vectors, matrices, linear systems of equations
Signal transforms • z-transform - - -
definition & properties complex variables region of convergence
• Fourier transform - -
frequency response Fourier transform
• Discrete Fourier Transform (DFT)
-
definition inverse DFT matrix form properties
-
Fast Fourier Transform (FFT)
-
Digital filtering using the DFT/FFT
- - -
z-transform (1) • definition:
discrete-time sequence in integer variable k z-transform Z(·) discrete-time series in complex variable z
z-transform (2) • definition: -
z-transform of a discrete-time signal:
{x[k]} = {. . . , x[ k], . . . , x[ 1], x[0], x[1], . . . , x[k], . . .}
z-transform Z(·)
X(z) = . . . + x[ k]z k + . . . + x[ 1]z + x[0] +x[1]z Z(x[k]) = X(z) =
1
+ . . . + x[k]z
1 X
k= 1
x[k]z
k
k
+ ...
z-transform (3) • definition: -
z-transform of a discrete-time system impulse response:
{h[k]} = {. . . , h[ k], . . . , h[ 1], h[0], h[1], . . . , h[k], . . .}
z-transform Z(·)
H(z) = . . . + h[ k]z k + . . . + h[ 1]z + h[0] +h[1]z Z(h[k]) = H(z) =
1
+ . . . + h[k]z
1 X
k= 1
h[k]z
k
k
+ ...
z-transform (4) • properties: -
linearity property:
⇢ -
Z(ax[k]) = aX(z) Z(x1 [k] + x2 [k]) = X1 (z) + X2 (z)
time-shift theorem:
Z(x[k -
d]) = z
d
X(z)
convolution theorem:
y[k] = h[k] ⇤ x[k] ) Y (z) = H(z)X(z)
z-transform (5) • region of convergence: -
the z-transform of an infinitely long sequence is a series with an infinite number of terms
X(z) = . . . + x[ k]z k + . . . + x[ 1]z + x[0] +x[1]z - -
1
+ . . . + x[k]z
k
+ ...
for some values of z the series may not converge the z-transform is only defined within the region of convergence (ROC):
ROC = {z 2 C|X(z) =
1 X
k= 1
x[k]z
k
6= 1}
Signal transforms • z-transform - - -
definition & properties complex variables region of convergence
• Fourier transform - -
frequency response Fourier transform
• Discrete Fourier Transform (DFT)
-
definition inverse DFT matrix form properties
-
Fast Fourier Transform (FFT)
-
Digital filtering using the DFT/FFT
- - -
Fourier transform (1) • Frequency response: -
for an LTI system a sinusoidal input signal
x[k] = ej!k = (cos !k + j sin !k) produces a sinusoidal output signal at the same frequency
y[k] = Aej(!k+ -
)
= A cos(!k + ) + j sin(!k + )
the output can be calculated from the convolution:
y[k]
=
1 X
h[m]x[k
m] =
m= 1
=
ej!k
1 X
m= 1
1 X
m= 1
h[m]e
j!m
h[m]ej!(k
m)
Fourier transform (2) • Frequency response: 1 X h[m]e j!m = m= 1
- -
1 X
h[m]z
m z=ej!
m= 1
=
H(z)
=
H(e )
z=ej! j!
the sinusoidal I/O relation is Aej(!k+ ) = H(ej! )ej!k the system’s frequency response H(ej! ) is a complex function of the radial frequency ω: • •
|H(ej! )| denotes the magnitude response \H(ej! ) denotes the phase response
Fourier transform (3) • Frequency response: -
-
the frequency response H(ej! ) is equal to the z-transform of the system’s impulse response, evaluated at z = ej! for 0 ! < 2⇡, ej! is a complex function describing the unit circle in the z-plane Im 1
e
z-plane j!
! -1
1 -1
Re
Fourier transform (4) • Frequency response & Fourier transform – the frequency response H(ej! ) of an LTI system is equal to the Fourier transform of the continuous-time impulse sequence constructed with h[k] :
F{hD (t)} = F
(
1 X
h[k] (t
kTs )
k= 1
)
f = . . . = H(e ), ! = 2⇡ fs j!
j!
j!
– the frequency spectrum of a discrete-time signal X(e ), Y (e ) (=its z-transform evaluated at the unit circle) is similarly equal to the Fourier transform of the continuous-time impulse sequence constructed with x[k], y[k]:
F{xD (t)} = F
(
1 X
k= 1
x[k] (t
• Input/output relation:
kTs )
)
f = . . . = X(e ), ! = 2⇡ fs j!
Y (ej! ) = H(ej! )X(ej! )
Signal transforms • z-transform - - -
definition & properties complex variables region of convergence
• Fourier transform - -
frequency response Fourier transform
• Discrete Fourier Transform (DFT)
-
definition inverse DFT matrix form properties
-
Fast Fourier Transform (FFT)
-
Digital filtering using the DFT/FFT
- - -
Discrete Fourier Transform (DFT) (1) • DFT definition: -
the Fourier transform of a signal or system is a continuous function of the radial frequency ω:
F(x[k]) = X(ej! ) = -
1 X
x[k]e
j!k
k= 1
the Fourier transform can be discretized by sampling it at N
2⇡ discrete frequencies !n = n, uniformly spaced between N 0 and 2π:
h
X e
j 2⇡ N n
i
=
N X1 k=0
x[k]e
j 2⇡ N nk
= DFT
Discrete Fourier Transform (DFT) (2) • Inverse discrete Fourier transform (IDFT): -
an N-point DFT can be calculated from an N-point time sequence:
h
X e -
j 2⇡ N n
i
=
N X1
x[k]e
j 2⇡ N nk
k=0
vice versa, an N-point time sequence can be calculated from an N-point DFT:
1 x[k] = N
N X1 k=0
h
X e
j
2⇡ N n
i
e
j 2⇡ N nk
= IDFT
Discrete Fourier Transform (DFT) (3) • matrix form -
using the shorthand notations
(
X[n] WN
h
=
X ej
=
j 2⇡ N
e
2⇡ N n
i
the DFT and IDFT definitions can be rewritten as:
DFT:
X[n] =
N X1
x[k]WNnk
k=0
IDFT:
N 1 1 X x[k] = X[n]WN nk N n=0
Discrete Fourier Transform (DFT) (4) • matrix form -
2 6 6 6 4
the DFT coefficients X[0], . . . , X[N calculated as
X[0] X[1] .. . X[N
3
2
WN0 6W 0 6 N
7 7 6 7 = 6 .. 5 4 . 1] WN0
WN0 WN1 .. .
(N WN
1)
1] can then be
... ... .. .
WN0 (N 1) WN
...
(N WN
.. .
1)2
32 76 76 76 74 5
x[0] x[1] .. . x[N
X = WN x -
3
an N-point DFT requires N2 complex multiplications
1]
7 7 7 5
Discrete Fourier Transform (DFT) (5) • matrix form -
2 6 6 6 4
x[0] x[1] .. . x[N
the IDFT coefficients x[0], . . . , x[N calculated as
3
2
WN0 6W 0 6 N
7 1 6 7 7= .. 5 N6 4 . 1] WN0
WN0 WN 1 .. .
WN
1 ⇤ x = WN X N
-
(N
1)
1] can then be
... ... .. .
WN0 (N 1) WN
...
(N
.. .
WN
1)2
32 76 76 76 74 5
3
X[0] X[1] .. . X[N
an N-point IDFT requires N2 complex multiplications
1]
7 7 7 5
Discrete Fourier Transform (DFT) (6) • properties: - -
linearity & time-shift theorem (cf. z-transform) frequency-shift theorem (modulation theorem):
e -
j!ck
x[k]
! X[n + c]
circular convolution theorem: if x[k] and h[k] are periodic with period N, then
N X1 m=0
x[m]h[k
m] =
N X1 m=0
x[k
m]h[m]
! X[n]H[n]
Discrete Fourier Transform (DFT) (7) • Fast Fourier Transform (FFT)
Carl Friedrich Gauss (1777-1855
• • • • • • • • • -
split up N-point DFT in two N/2-point DFTs split up two N/2-point DFT’s in four N/4-point DFTs … split up N/2 2-point DFT’s in N 1-point DFTs calculate N 1-point DFTs rebuild N/2 2-point DFTs from N 1-point DFTs … rebuild two N/2-point DFTs from four N/4-point DFTs rebuild N-point DFT from two N/2-point DFTs
DFT complexity of N2 multiplications is reduced to FFT complexity of 1/2 N log2(N) multiplications
James W. Cooley
divide-and-conquer approach:
John W.Tukey
-
Discrete Fourier Transform (DFT) (8) • Linear and circular convolution: -
circular convolution theorem: due to the sampling of the frequency axis, the IDFT of the product of two N-point DFTs corresponds to the circular convolution of two length-N periodic signals N X1
x[m]h[k
m] =
m=0
-
N X1
x[k
m]h[m]
m=0
! X[n]H[n]
LTI system: the output sequence is the linear convolution of the impulse response with the input signal
y[k] =
N X1 m=0
x[k
m]h[m]
Discrete Fourier Transform (DFT) (9) • Linear and circular convolution: -
the linear convolution of a length-(M+1) impulse response h[k] with a length-L input signal x[k] is equivalent to their N-point circular convolution if both sequences are zeropadded to length N:
N h[k] x[k] y[k]
L+M
zero padding
Les 2: Inleiding 2 • Complex number theory complex numbers, complex plane, complex sinusoids, circular motion, sinusoidal motion, …
• Signal transforms z-transform, Fourier transform, discrete Fourier transform
• Matrix algebra vectors, matrices, linear systems of equations
Matrix algebra: overview • Vectors definition & geometrical interpretation - elementary operations - inner product & angle - norm - outer product - linear (in)dependence • Matrices • Linear systems of equations -
Vectors: definition & geom. interpretation • Definition array of real- or complex-valued numbers or variables (in DSP: array of signal samples, DFT coefficients, …) - vector transpose: column vector ⟷ row vector -
3
2
x1 6 x2 7 ⇥ 6 7 T x = 6 . 7 , x = x1 4 .. 5 xN
• Geometrical interpretation -
array of coordinates of a point in N-dimensional space
x2 x2
...
xN
⇤
2-D example: x=
1 2
x1
2 1
Vectors: elementary operations • Addition
x1 y1 x 1 + y1 x+y = + = =z x2 y2 x 2 + y2 z
y x
• Scalar product -
changes vector length but not direction
x1 ax1 ax = a = x2 ax2
ax x
Vectors: inner product & angle • Inner product (= scalar !) T
⇥
hx, yi = x y = x1
x2
...
• Angle - -
-
2
3
y1 N 7 X y ⇤6 6 27 xN 6 . 7 = x n yn 4 .. 5 n=1
yN
y
↵ let ||x|| denote length of vector x x angle between vectors is then related to inner product
hx, yi = kxkkyk cos(↵)
orthogonal vectors have zero inner product
Vectors: norm v uN uX p p kxk = kxk2 = hx, xi = xT x = t |xn |2
• Norm = Euclidian norm = L2 norm • Geometric interpretation
n=1
vector length: kxk - distance between vectors: kx yk • Widely used in DSP ! - norm → signal RMS value - squared norm → average signal power • Other norms X N L1 norm: kxk1 = |xn |, L1 norm: kxk1 = max |xn | -
n=1
n
Vectors: outer product • Outer product (= matrix !)
xy
T
=
=
3
2
x1 6 x2 7 ⇥ 6 7 6 .. 7 y1 4 . 5 2
y2
...
xN
x 1 y1 6 x 2 y1 6 6 .. 4 .
x N y1
x 1 y2 x 2 y2 .. .
... ... .. .
x N y2
...
yN
⇤ 3
x 1 yN x 2 yN 7 7 .. 7 . 5
x N yN
Vectors: linear (in)dependence • Linear (in)dependence - -
property of a set of vectors set of P vectors x1 , x2 , . . . , xP is linearly independent: P X
n=1 -
-
an x n = 0 ) a1 = a2 = . . . = aP = 0
size P of set of linearly independent vectors ≤ length N trivial
2 3 2 3 2 3 0 0 1 607 607 617 6 7 7 6 7 example: 6 6 .. 7 , 6 .. 7 , . . . , 6 .. 7 4.5 4.5 4.5 0
0
1
• Related concepts: space, basis, dimension
Matrix algebra: overview • Vectors • Matrices definition & elementary operations - matrix product - matrix-vector product - matrix decomposition & rank - structured matrices - matrix form convolution • Linear systems of equations -
Matrices: definition & elementary ops. • Definition: M x N matrix
2
a11 6 a21 6 A = {am,n } = 6 . 4 ..
aM 1
a12 a22 .. .
... ... .. .
a1N a2N .. .
aM 2
...
aM N
• Elementary operations: - - -
transpose: AT = {an,m }
(= N x M matrix)
addition: A + B = {am,n + bm,n } scalar product: cA = {cam,n }
3 7 7 7 5
Matrices: matrix product • Matrix product -
dimensions:
A |{z} B = |{z} C |{z}
M ⇥N N ⇥P -
definition: C = {cm,p } =
• Example
a11 a21
a12 a22
a13 a23
2
b11 4b21 b31
b12 b22 b32
b13 b23 b33
M ⇥P
(
N X
am,n bn,p
n=1
3
b14 c b24 5 = 11 c21 b34
)
c12 c22
c13 c23
c14 c24
Matrices: matrix-vector product • Matrix-vector product: • Two interpretations: -
A |{z} b = |{z} c |{z}
M ⇥N N ⇥1
M ⇥1
matrix-vector product = stacking inner products
⇥
am1
am2
...
⇤
amN b = cm , 8m
product = linear combination of columns 3 2 3 3 2 3 2 2matrix-vector c1 a1N a12 a11 6 a2N 7 6 c2 7 6 a22 7 6 a21 7 6 7 6 7 6 7 7 6 b 1 6 . 7 + b2 6 . 7 + . . . + b N 6 . 7 = 6 . 7 4 .. 5 4 .. 5 4 .. 5 4 .. 5 -
aM 1
aM 2
aM N
cM
Matrices: matrix decomposition & rank • Matrix decomposition -
N x N matrix can be decomposed as sum of R ≤ N outer products of linearly independent vectors
A=
R X
T v v n n n
n=1
-
“eigenvalue decomposition”: • eigenvalues n • eigenvectors vn
general M x N matrices: “singular value decomposition” • Rank = R - rank-deficient / singular matrix: R < min(M, N ) - full-rank matrix: R = min(M, N ) -
Matrices: structured matrices (N x N) • Diagonal matrices & identity matrices
2
a11 6 0 6 A=6 . 4 .. 0
3
0 a22 .. .
... ... .. .
0 0 .. .
0
...
aN N
• Symmetric matrices:
2
a11 6 a12 6 T A=A =6 . 4 ..
a1N
7 7 7, 5
a12 a22 .. .
... ... .. .
a2N
...
2
1 60 6 I = 6. 4 .. 0
3
a1N a2N 7 7 .. 7 . 5
aN N
0 1 .. .
... ... .. .
0
...
3 0 07 7 .. 7 .5 1
Matrices: structured matrices (M x N) • Hankel: constant anti-diagonals (always symmetric !) 2
a1 6 a2 6 6 A = 6 a3 6 .. 4 .
aM
a2 a3 a4 .. .
a3 a4 a5 .. .
... ... ... .. .
aM +1
aM +2
...
3
aN aN +1 aN +2 .. . aN +M
1
7 7 7 7 7 5
• Toeplitz & circulant: constant diagonals 2
aM 6aM 1 6 6 A = 6aM 2 6 .. 4 . a1
aM +1 aM aM 1 .. .
aM +2 aM +1 aM .. .
... ... ... .. .
aM +N aM +N aM +N .. .
a2
a3
...
aN
3 2
a1 7 6 2 7 6 a2 7 6 3 7 , 6 a3 7 6 .. 5 4 .
1
aM
aN a1 a2 .. . aM +N
aN 1 aN a1 .. . 1
aM +N
2
... ... ... .. .
a2 a3 a4 .. .
...
aM +1
3 7 7 7 7 7 5
Matrices: matrix form convolution • Input signal vector or Toeplitz matrix 2
6 6 6 x=6 6 4
3
x0 x1 x2 .. . xL
1
7 7 7 7 7 5
2
x0 6x1 6 6 X = 6 x2 6 .. 4.
0 x0 x1 .. .
0 0 x0 .. .
... ... ... .. .
0 0 0 .. .
0
0
...
xL
0
• Filter vector or Toeplitz matrix 3
2
h0 6 h1 7 6 7 6 7 h = 6 h2 7 6 .. 7 4 . 5 hM
2
h0 6 h1 6 6 H = 6 h2 6 .. 4.
0 h0 h1 .. .
0 0 h0 .. .
... ... ... .. .
0 0 0 .. .
0
0
...
hM
0
• Output signal vector:
3
1
7 7 7 7 7 5
3 7 7 7 7 7 5
y = Hx = Xh
Matrix algebra: overview • Vectors • Matrices • Linear systems of equations - -
square systems + matrix inverse rectangular systems + matrix pseudo-inverse
Linear systems of equations: square • Square systems: no. equations = no. unknowns = N a11 x1 + a12 x2 + . . . + a1N xN
=
b1
a21 x1 + a22 x2 + . . . + a2N xN
= .. .
b2
aN 1 x1 + aN 2 x2 + . . . + aN N xN
=
bN
, Ax = b
• Solution vector
x=A
1
b
• Matrix inverse A
1
exists only if matrix rank R = N
Linear systems of equations: rectangular • Rectangular systems: M equations, N unknowns a11 x1 + a12 x2 + . . . + a1N xN
=
b1
a21 x1 + a22 x2 + . . . + a2N xN
= .. .
b2
aM 1 x1 + aM 2 x2 + . . . + aM N xN
=
bM
, Ax = b
• Underdetermined systems: M < N - -
infinitely many solutions ! minimum-norm solution: min kxk s.t. Ax = b
x=A |
T
AA {z A+
T
1
}
b
Linear systems of equations: rectangular • Overdetermined systems: M > N - -
no exact solution ! best approximation (in least squares sense): T
x= A A | {z
A+
• Pseudo-inverse - -
1
AT b }
underdetermined case A overdetermined case A
+
+
T
AA
T
1
=A
= A A
T
AT
1