Discrete-Time Overview of Some Signal Spectra

Discrete-Time
University of Toronto
1 of 40
© D. Johns, K. Martin, 1997
Overview of Some Signal Spectra
s(t)
x(n) = x c(nT) y(n)
x c(t) x s(t)
convert to
discrete-time
sequence
convert to
impulse
train
DSP
y sh(t)
y s(t)
hold
analog
low-pass
filter
y c(t)
Conceptual
x c(t)
y sh(t)
x sh(t) x(n) = x (nT) y(n)
c
sample
and
hold
A/D
converter
DSP
D/A
converter
with hold
analog
low-pass
filter
y c(t)
Typical Implementation
University of Toronto
2 of 40
© D. Johns, K. Martin, 1997
Example Signal Spectra
τx s(t)
A
x c(t)
A
--T
x(n)
4
0
1 2
fo
t
τ→0
5 6 7
3
X c(f)
X s(f)
fo
n
A
--T
t
fs
2f s
2π
4π
fs
2f s
f
f
X(ω)
( 2πf o ) ⁄ f s
x sh(t)
ω
X sh(f)
A
fo
time
fs
f
frequency
University of Toronto
3 of 40
© D. Johns, K. Martin, 1997
Example Signal Spectra
• X s(f) has same spectra as X c(f) but repeats every f s
(assuming no aliasing occurs).
• X(ω) has same spectra as X s(f) freq axis normalized.
sin x
• Spectra for X sh(f) equals X s(f) multiplied by ---------x
response — in effect, filtering out high frequency
images.
University of Toronto
4 of 40
© D. Johns, K. Martin, 1997
Laplace Transform & Discrete-Time
x c(t)
τx s(t)
(all pulses)
nT
τ
2T
t
T
3T
τx sn(t)
(single pulse at nT)
• x s(t) scaled by τ such that the area under the pulse at
nT equals the value of x c(nT) .
• In other words, at t = nT , we have
x c(nT)
x s(nT) = -------------τ
(1)
University of Toronto
5 of 40
© D. Johns, K. Martin, 1997
Laplace Transform & Discrete-Time
• Thus as τ → 0 , height of x s(t) at time nT goes to ∞ and
so we plot τx s(t) instead.
• Define ϑ(t) to be the step function,

ϑ(t) ≡  1 ( t ≥ 0 )
 0 (t < 0)
(2)
• then single-pulse signal, x sn(t) , can be written as
x c(nT)
x sn(t) = --------------- [ ϑ(t – nT) – ϑ(t – nT – τ) ]
τ
(3)
and the entire signal x s(t) as
∞
x s (t) =
∑
x sn(t)
(4)
n = –∞
University of Toronto
6 of 40
© D. Johns, K. Martin, 1997
Laplace Transform & Discrete-Time
• Above signals are defined for all time — we can find
Laplace transforms of these signals.
• The Laplace transform X sn(s) for x sn(t) is
– sτ
– snT
1 1–e
X sn(s) = ---  ------------------ x c(nT)e
τ s 
(5)
and X(s) is simply a linear combination of x sn(t) , which
results in
∞
–s τ
1 1–e
X s(s) = ---  ------------------
τ s 
∑
x c(nT)e
– snT
(6)
n = –∞
University of Toronto
7 of 40
© D. Johns, K. Martin, 1997
Laplace Transform & Discrete-Time
2
• Using the expansion e = 1 + x + x----- + … , when τ → 0 ,
2!
x
the term before the summation in (6) goes to unity.
• Therefore, as τ → 0 ,
∞
X s(s) =
∑
x c(nT)e
– snT
(7)
n = –∞
• This Laplace transform only depends on sample
points, x c(nT) which in turn depends on the relative
sampling-rate, T .
University of Toronto
8 of 40
© D. Johns, K. Martin, 1997
Spectra of Discrete-Time Signals
• x s(t) spectra can be found by replacing s = jω in (7)
• However, a more intuitive approach is ...
• Define a periodic pulse train, s(t) as
∞
∑
s(t) =
δ(t – nT)
(8)
n = –∞
where δ(t) is the unit impulse function.
• Then x s(t) can be written as
x s(t) = x c(t)s(t)
1
X s(jω) = ------ X c(jω) ⊗ S(jω)
2π
(9)
(10)
where ⊗ denotes convolution.
University of Toronto
9 of 40
© D. Johns, K. Martin, 1997
Spectra of Discrete-Time Signals
• Since the Fourier transform of a periodic impulse
train is another periodic impulse train we have
2π
S(jω) = -----T
∞
∑
k = –∞
2π
δ(ω – k ------)
T
(11)
• Thus, the spectra X s(jω) is found to be
1
X s(jω) = --T
1
X s(f) = --T
University of Toronto
∞
∑
k = –∞
∞
∑
jk2π
X c(jω – -----------)
T
X c(j2πf – jk2πf s)
(12)
(13)
k = –∞
10 of 40
© D. Johns, K. Martin, 1997
Spectra for Discrete-Time Signals
• The spectra for the sampled signal x s(t) equals a sum
of shifted spectra of x c(t) .
• No aliasing will occur if X c(jω) is bandlimited to f s ⁄ 2 .
• Note that x s(t) can not exist is practice as it would
require an infinite amount of power (seen by
integrating X s(f) over all frequencies).
University of Toronto
11 of 40
© D. Johns, K. Martin, 1997
Spectra Example
x(n)
X s(f), X(ω)
x c(t) τx (t)
s
t
(n)
0.25 0.5
(1) (2)
x(n)
x c(t) τx (t)
s
0.25 0.5
(3) (6)
University of Toronto
1Hz
( 0.5π )
4Hz
( 2π )
8Hz
( 4π )
f
(ω)
X s2(f), X 2(ω)
t
( n ) 1Hz
 π
-- 6
12Hz
( 2π )
24Hz
( 4π )
f
(ω)
12 of 40
© D. Johns, K. Martin, 1997
Z-Transform
• The z-transform is merely a shorthand notation for
(7).
• Specifically, defining
z≡e
sT
(14)
• we can write
∞
X(z) ≡
∑
x c(nT)z
–n
(15)
n = –∞
• where X(z) is called the z-transform of the samples
x c(nT) .
University of Toronto
13 of 40
© D. Johns, K. Martin, 1997
Z-Transform
• 2 properties of the z-transform are:
–k
— If x(n) ↔ X(z) , then x(n – k) ↔ z X(z)
— Convolution in the time domain is equivalent to
multiplication in the frequency domain.
X(z) is not a function of the sampling-rate!
• A 1Hz signal sampled at 10Hz has the same
transform as a similar 1kHz signal sampled at 10kHz
• X(z) is only related to the numbers, x c(nT) while X s(s)
is the Laplace transform of the signal x s(t) as τ → 0 .
• Think of the series of numbers as having a samplerate normalized to T = 1 (i.e. f' s = 1Hz ).
University of Toronto
14 of 40
© D. Johns, K. Martin, 1997
Z-Transform
• Such a normalization results in
X s(f) = X(2πf
--------)
fs
(16)
or equivalently, a frequency scaling of
2πf
ω = -------fs
(17)
• Thus, discrete-time signals have ω in units of
radians/sample.
• Continuous-time signals have frequency units of cycles/
second (hertz) or radians/second.
University of Toronto
15 of 40
© D. Johns, K. Martin, 1997
Example Sinusoidal Signals
x(n)
x(n)
1
5
10
15
1
5
10
15
n
n
0 rad/sample = 0 cycles/sample
π ⁄ 8 rad/sample = 1 ⁄ 16 cycles/sample
x(n)
x(n)
1
5
10
15
n
π ⁄ 4 rad/sample = 1 ⁄ 8 cycles/sample
University of Toronto
1
5
10
15
n
π ⁄ 2 rad/sample = 1 ⁄ 4 cycles/sample
16 of 40
© D. Johns, K. Martin, 1997
Example Sinusoidal Signals
• A continuous-time sinusoidal signal of 1kHz when
sampled at 4kHz will change by π ⁄ 2 radians between
each sample.
• Such a discrete-time signal is defined to have a
frequency of π ⁄ 2 rad/sample .
• Note that discrete-time signals are not unique since
the addition of 2π will result in the same signal.
• For example, a discrete-time signal having a
frequency of π ⁄ 4 rad/sample is identical to that of
9π ⁄ 4 rad/sample .
• Normally discrete-time signals are defined to have
frequency components only between – π and π
rad/sample.
University of Toronto
17 of 40
© D. Johns, K. Martin, 1997
Downsampling
n
0
4
π
--6
n
L
8
L = 4
ω
2π
0
0
1
4π
-----6
2
ω
2π
• Keep every L ‘th sample and throw away L – 1 samples.
• It expands the original spectra by L .
• For aliasing not to occur, original signal must be
bandlimited to π ⁄ L .
University of Toronto
18 of 40
© D. Johns, K. Martin, 1997
Upsampling
n
0
1
2
4π----6
0
n
L
L = 4
ω
2π
0
4
8
π
--6
π
2π
• Insert L – 1 zero values between samples
• The frequency axis is scaled by L such that 2π now
occurs where L2π occurred in the original signal.
• No worry about aliasing here.
University of Toronto
19 of 40
© D. Johns, K. Martin, 1997
Discrete-Time Filters
u(n)
H(z)
y(n)
(y(n) equals h(n) if u(n) is an impulse)
(discrete-time filter)
• An input series of numbers is applied to a discretetime filter to create an output series of numbers.
• This filtering of discrete-time signals is most easily
visualized with the shorthand notation of z-transforms .
Transfer-Functions
• Similar to those for continuous-time filters except
instead of polynomials in “ s ”, polynomials in “ z ” are
obtained.
University of Toronto
20 of 40
© D. Johns, K. Martin, 1997
Cont-Time Transfer-Function
• Low-pass continuous-time filter, H c(s) ,
4
H c(s) = -------------------------2
s + 2s + 4
(18)
• The poles are the roots of the denominator
polynomial
• Poles: – 1.0 ± 1.7321j for this example.
• Zeros: Defined to have two zeros at ∞ since the den
poly is two orders higher than the numerator poly.
University of Toronto
21 of 40
© D. Johns, K. Martin, 1997
Cont-Time Frequency Response
high-frequency
s-plane
jω = ∞
jω
(poles)
dc
jω = 0
• Poles and zeros plotted in the s -plane.
• Substitution s = jω is equivalent to finding the
magnitude and phase of vectors from a point along
the jω axis to all the poles and zeros.
University of Toronto
22 of 40
© D. Johns, K. Martin, 1997
Discrete-Time Transfer-Function
0.05
H(z) = -------------------------------------2
z – 1.6z + 0.65
(19)
• Poles: 0.8 ± 0.1j in the z -plane and two zeros are
again at ∞ .
• To find the frequency response of H(z) , the poles and
zeros can be plotted in the z -plane, and the unit
circle contour is used, z = e
jω
University of Toronto
23 of 40
© D. Johns, K. Martin, 1997
Discrete-Time Frequency Response
ω = π⁄2
j
e
jω
z-plane
ω = 0
-1
ω
1
ω = 2π
ω = π
-j
3π
ω = -----2
• Note that poles or zeros occurring at z = 0 do not
affect the magnitude response of H(z) since a vector
from the origin to the unit circle always has a length
of unity. However, they would affect the phase
response.
University of Toronto
24 of 40
© D. Johns, K. Martin, 1997
Discrete-Time Frequency Response
• z = 1 corresponds to the frequency response at both
dc (i.e. ω = 0 ) and for ω = 2π .
• The time normalization of setting T = 1 implies that
ω = 2π is equivalent to the sampling-rate speed (i.e.
f = f s ) for X s(f) .
• As with cont-time filter, if filter coefficients are real,
poles and zeros occur in complex-conjugate pairs —
magnitude is symmetric, phase is anti-symmetric.
• Going around the circle again would give the same
result as the first time implying that the frequency
response repeats every 2π .
University of Toronto
25 of 40
© D. Johns, K. Martin, 1997
Stability of Discrete-Time Filters
x(n)
b
y(n + 1)
z
–1
y(n)
a
• To realize rational polynomials in “ z ”, discrete-time
–1
filters use delay elements (i.e. “ z ” building blocks)
much the same way that analog filters can be formed
–1
using integrators (i.e. “ s ” building blocks).
• The result is finite difference equations describing
discrete-time filters
University of Toronto
26 of 40
© D. Johns, K. Martin, 1997
Stability of Discrete-Time Filters
• A finite difference equation can be written for above
system
y(n + 1) = bx(n) + ay(n)
(20)
• In the z -domain, this equation is written as
zY(z) = bX(z) + aY(z)
(21)
• We find H(z) given by
Y(z)
bH(z) ≡ ---------- = ---------X(z)
z–a
(22)
which has a pole on the real axis at z = a .
University of Toronto
27 of 40
© D. Johns, K. Martin, 1997
Stability of Discrete-Time Filters
• To test for stability, let the input x(n) be an impulse
y(0) = k
where k is some arbitrary initial state value for y .
y(1) = b + ak
2
y(2) = ab + a k
2
3
3
4
y(3) = a b + a k
y(4) = a b + a k
:
University of Toronto
28 of 40
© D. Johns, K. Martin, 1997
Stability of Discrete-Time Filters
• The response, h(n) , is seen to be given by

0 (n < 1)

h( n) = 
 ( an – 1 b + an k ) ( n ≥ 1 )

(23)
• This response remains bounded only when a ≤ 1 for
this first-order filter and is unbounded otherwise.
• In general, a linear time-invariant discrete-time
filter, H(z) , is stable if and only if all its poles are
located within the unit circle.
University of Toronto
29 of 40
© D. Johns, K. Martin, 1997
IIR Filters
• Infinite-Impulse-Response (IIR) filters are those
discrete-time filters that when excited by an impulse,
their outputs remain non-zero assuming infinite
precision arithmetic.
• The above example is IIR when a ≠ 0
• IIR filters can be more efficient when long impulse
responses are needed.
• They have some unusual behaviors due to finiteprecision effects such as limit-cycles.
University of Toronto
30 of 40
© D. Johns, K. Martin, 1997
FIR Filters
• Finite-Impulse-Response (FIR) filters are those
discrete-time filters that when excited by an impulse,
their outputs go precisely to zero (and remain zero)
after a finite value of n .
• Example — running average of 3
1
y(n) = --- ( x(n) + x(n – 1) + x(n – 2) )
3
1
H(z) = --3
(24)
2
∑z
–i
(25)
i=0
• Has poles but they all occur at z = 0 .
• FIR filters are always stable and exact linear phase
filters can be realized.
University of Toronto
31 of 40
© D. Johns, K. Martin, 1997
Bilinear Transform
• Consider H c(p) as a continuous-time transfer-function
(where “ p ” is the complex variable equal to σ p + jΩ ),
the bilinear transform is defined to be given by,
z–1
p = ---------z+1
(26)
• The inverse transformation is given by,
+ pz = 1
----------1–p
(27)
• The z -plane locations of 1 and -1 (i.e. dc and f s ⁄ 2 )
are mapped to p -plane locations of 0 and ∞ ,
respectively.
University of Toronto
32 of 40
© D. Johns, K. Martin, 1997
Bilinear Transform
jω
• The unit circle, z = e , in the z -plane is mapped to
the entire jΩ axis in the p -plane.
j(ω ⁄ 2)
jω
j(ω ⁄ 2)
–j ( ω ⁄ 2 )
(e
–e
)
e
e –1
p = ----------------- = ------------------------------------------------------------------jω
j(ω ⁄ 2) j(ω ⁄ 2 )
–j ( ω ⁄ 2 )
e
(e
+e
)
e +1
2j sin ( ω ⁄ 2 )
= ----------------------------- = j tan ( ω ⁄ 2 )
2 cos ( ω ⁄ 2 )
(28)
(29)
• Results in the following frequency “warping”.
Ω = tan ( ω ⁄ 2 )
(30)
University of Toronto
33 of 40
© D. Johns, K. Martin, 1997
Bilinear Transform Filter Design
• Design a continuous-time transfer-function, H c(p) ,
and choose the discrete-time transfer-function, H(z) ,
such that
H(z) ≡ H c(( z – 1 ) ⁄ ( z + 1 ))
(31)
so that
jω
H(e ) = H c(j tan ( ω ⁄ 2 ))
(32)
• The response of H(z) is seen to be equal to the
response of H c(p) except with a frequency “warping”
• Order of the cont-time and discrete-time also same.
University of Toronto
34 of 40
© D. Johns, K. Martin, 1997
Bilinear Design Example
• Find a first-order H(z) that has a 3db frequency at
f s ⁄ 20 , a zero at -1 and a dc gain of one.
• Using (30), the frequency value, f s ⁄ 20 , or
equivalently, ω = ( 2π ) ⁄ 20 = 0.314159 is mapped to
Ω = 0.1584 .
• Thus, H c(p) should have a 3dB frequency value of
0.1584 rad/s.
• Such a 3db frequency value is obtained by having a
p -plane zero equal to ∞ and pole equal to -0.1584.
University of Toronto
35 of 40
© D. Johns, K. Martin, 1997
Bilinear Design Example
• Transforming these continuous-time pole and zero
back using (27) results in a z -plane zero at -1 and a
pole at 0.7265.
• Therefore, H(z) appears as
k(z + 1)
H(z) = -----------------------z – 0.7265
(33)
• The constant k can be determined by setting the dc
gain to one, or equivalently, H(1) = 1 which results in
k = 0.1368 .
University of Toronto
36 of 40
© D. Johns, K. Martin, 1997
Sample-and-Hold Response
• A sample-and-held signal, x sh(t) , is related to its
sampled signal by the mathematical relationship,
∞
x sh(t) =
∑
x c(nT) [ ϑ(t – nT) – ϑ(t – nT – T) ]
(34)
n = –∞
• x sh(t) is well-defined for all time and thus the Laplace
transform can be found to be equal to
∞
– sT
1–e
X sh(s) = ------------------s
∑
x c(nT)e
– snT
n = –∞
sT
1–e
= ---------------- X s(s)
s
(35)
University of Toronto
37 of 40
© D. Johns, K. Martin, 1997
Sample-and-Hold Response
• The hold transfer-function, H sh(s) , is equal to
– sT
1–e
H sh(s) = ------------------s
(36)
• The spectra for H sh(s) is found by substituting s = jω
– jωT
1–e
H sh(jω) = ---------------------- = T × e
jω
University of Toronto
jωT
– --------2
ωT
sin  -------
 2
× -------------------- ωT
-------
 2
(37)
38 of 40
© D. Johns, K. Martin, 1997
Sample-and-Hold Response
• The magnitude of this response is given by
ωT
sin  -------
 2
H sh(jω) = T -----------------------ωT
------2
πf
sin  -----
f 
s
H sh(f) = T --------------------πf
----fs
or
(38)
sin x
x
• referred to as the “ ---------- ” or “sinc” response.
University of Toronto
39 of 40
© D. Johns, K. Martin, 1997
Sample-and-Hold Response
H sh(jω)
–3 fs
–2 fs
–fs
0
fs
2f s
f
3f s
• This frequency shaping of a sample-and-hold only
occurs for a continuous-time signal.
• Specifically, a sample-and-hold before an A/D
converter does not aid in any anti-aliasing
requirement since the A/D converter has a true
discrete-time output.
University of Toronto
40 of 40
© D. Johns, K. Martin, 1997