ICE 3018
2. Discrete Signals
ICE3018: Digital Signal Processing & Design
School of Information & Communication Engineering
Inha University
Image credit: SINTEF
2. Discrete Signals
Things to learn
1. Time shift and time reversal for discrete signal
2. Even symmetry and odd symmetry
3. Classification of a discrete signal based on energy and power
4. Basics of interpolation and decimation
5. Definitions of standard signal forms
6. Digital frequency of a sinusoid or complex harmonics
7. The common period of a sum of sinusoids or complex
harmonics.
8. Sampling theorem and sampling rate
9. Aliasing
2
2.1 Discrete Signals
Definition:
A sampled or discrete signal x[n] is just an ordered
sequence of values corresponding to the integer index n.
x(t) : analog signal (t: continuous time variable)
x[n]: discrete signal (n: integer)
n=0
⇓ ⇓
40
x[n] = {1, 2, 4, 8} vs. y[n] = {8, 4, 2, 1}
30
20
10
(ML) x=[1, 2, 4, 8]; n=[0, 1, 2, 3]; 0
-10
-20
-30
-40 x[0], x[1], x[2], …, x[n], …, x[20]
3
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2.1 Discrete Signals
Infinite-length signals
Left-sided if x[n] = 0 for n>N0
Where N0 is a certain integer.
Right-sided if x[n] = 0 for n<N0
Causal if x[n] = 0 for n<0 Positive-time sequence
Anti-causal if x[n] = 0 for n>0 Negative-time sequence
N0) N0) 0) > 0)
N0 N0
4
2.1 Discrete Signals
Signal Measures
Summation (equivalent to integration for continuous signal)
∞ ∞
Discrete sum S D = ∑ x[n],
n = −∞
Absolute sum S A = ∑ x[n]
n = −∞
n
Cummulative sum SC [n] = ∑ x[k ] (also Running sum)
k = −∞
x[n]is absolutely summable if its SA is finite.
Instantaneous power p[n] = x[n]
2
Signal energy of non-periodic signal
∞ ∞ 2
E= ∑ p[m] = ∑ x[m]
m = −∞ m = −∞
x[n] is called an Energy signal if E is finite
5
2.1 Discrete Signals
Periodic signals
x[n] = x[n ± kN], k=0, 1, 2, …
where N is the smallest number of samples that repeat and is
always an integer.
1 N −1
Average value : xav =
N
∑ x[m]
m =0
1 N −1
∑ x[m]
2
Average power : P =
N m =0
For non-periodic signals
1 L
Average value : xav = lim ∑ x[m]
L →∞ 2 L + 1
m=− L
1 L
∑ x[m]
2
Average power : P = lim
L →∞ 2 L + 1
m=− L
x[n] is called a Power signal if its P is finite.
6
2.2 Operations on Discrete Signals
Time shift
Delayed when α > 0
y[n] = x[n − α ]
Advanced when α < 0
Letting m = n − α , n = m + α . Hence, y[m + α ] = x[m]
Time reversal (Mirror image)
Replace n by (-n) y[n] = x[− n]
Folding: reversal around n=0
Shift-and-reversal
x[n] → [delay (shift right) by α ] → x[n − α ] → [reversal] → x[− n − α ]
x[n] → [reversal] → x[− n] → [advance (shift left) by α ] → x[− (n + α )]
1
7
2.2 Operations on Discrete Signals
Symmetry
Even symmetric xe [n] = xe [− n]
Odd symmetric (Anti-symmetric) xo [n] = − xo [− n]
8
2.2 Operations on Discrete Signals
Decomposition of Arbitrary signal
x[n] = xe [n] + xo [n]
1
where xe [n] = {x(n ) + x(− n )} and xo [n] = 1 {x(n ) − x(− n )}
2 2
Any signal can be expressed as the sum of an even symmetric
part and an odd symmetric part
Even symmetry and odd symmetry are mutually exclusive.
9
2.2 Operations on Discrete Signals
Examples of even functions?
Examples of odd functions?
10
2.3 Decimation and Interpolation
Decimation
Reducing the signal length by discarding signal samples
Decimation by 2: y[n] = x[2n] = {x[0], x[2], x[4], …}
Length of y[n] is reduced by a factor of 2
Decimation by N: y[n] = x[Nn] = {x[0], x[N], x[2N], x[3N], …}
Length of y[n] is reduced by a factor of N.
11
2.3 Decimation and Interpolation
Interpolation
Increasing the signal length by inserting signal samples
Interpolation by 2: y[n] = x[n/2] = {x[0], x[1/2], x[2/2], x[3/2], …}
Length of y[n] is increased by a factor of 2
Interpolation by N: y[n] = x[n/N]
Need to insert (N-1) samples between x[n] and x[n+1]
For a discrete signal x[n], how to decide new samples?
Zero interpolation (Up-sampling): all new samples are zero
Step interpolation: equal to the previous sample value
Linear interpolation: average of adjacent samples
12
2.3 Decimation and Interpolation
Are decimation and interpolation inverse operations?
Decimation is indeed the inverse of interpolation, but the
converse is not necessarily true.
When both operations need to be performed in
succession, interpolate first!
13
Application of Decimation and Interpolation
M
Fractional Delays y[n] = x n − where M, N are integers.
N
M Nn − M
Generating y[n] = x n − = x from x[n]
N N
n n − M
x[n] ⇒ [Interpolation by N ] ⇒ x ↑ ⇒ [Delay by M ] ⇒ x
N N
Nn − M
⇒ [Decimation by N ] ⇒ x = y[n]
N
14
2.4 Standard Discrete Signals
Unit impulse (or Unit sample) Dirac delta function
0 , n ≠ 0
δ [n] =
Unit step 1, n = 0
0 , n < 0
u[n] =
1, n ≥ 0
Unit ramp
0 , n < 0
r [n] = nu[n] =
n , n ≥ 0
δ [n] = u[n] − u[n − 1]
15
2.4 Standard Discrete Signals
Properties of Discrete Impulse
Product of x[n] with δ[n-k]: x[n]δ [n − k ] = x[k ]δ [n − k ]
Sifting property
∞
∑ x[n]δ [n − k ] = x[k ]
n = −∞
Impulse with the
magnitude x[k]
x[n] δ[n-3]
1
1
2
x =
k=3 k=3
16
2.4 Standard Discrete Signals
Signal Representation by Impulses
Expressing x[n] as a sum of shifted impulses δ[n-k]
x[n]
∞
x[n] = ∑ x[k ]δ [n − k ]
k = −∞
∞
x[-1]×δ[n+1]
Ex: 𝑢𝑢 𝑛𝑛 = � 𝛿𝛿 𝑛𝑛 − 𝑘𝑘 and
𝑘𝑘=0
x[0]×δ[n]
𝑟𝑟 𝑛𝑛 = ∑∞
𝑘𝑘=0 𝑘𝑘 ⋅ 𝛿𝛿 𝑛𝑛 − 𝑘𝑘
x[1]×δ[n-1]
As a cumulative sum (or running sum)
n n −1
u[n] = ∑ δ [k ] and r[n] = ∑ u[k ]
k = −∞ k = −∞
17
2.4 Standard Discrete Signals
Discrete Pulse Signals
n 1, n≤N
• Discrete rectangular pulse : rect =
2 N 0 , elsewhere
n
n
• Discrete triangular pulse : tri = 1 − N , n≤N
N 0, elsewhere
Both signal has (2N+1) samples.
18
2.4 Standard Discrete Signals
Discrete Sinc Function
nπ
sin
n N , and sinc (0 ) = 1
sinc = >> x = linspace(-5,5);
N nπ
>> y = sinc(x);
N >> stem(x,y)
sinc(n/N) = 0 at n=kN, k=±1, ±2, …
19
Transform of Sinc function
Time Freq
Transformation
domain Domain
Box-car Sinc
Fourier Transform
Sinc Inverse Fourier Box-car
Transform
F.T.
20
Continuous Sinc Function
Rectangular pulse signal: Window (Truncation) function
Forward FT
21
Continuous Sinc Function
Transfer function of Ideal
Bandlimited signal: Low-pass Filter
Inverse FT
22
2.4 Standard Discrete Signals
Discrete Exponentials
Real-valued exponential signal
x[n] = a nu[n] - decaying for a < 1
Complex-valued exponential signal
x[n] = (a + jb ) u[n] = re
n
( ) u[n]
jω o n
r : attenuation when r < 1
= r n e jnωo u[n] = r n [cos (nωo ) + jsin(nωo )]u[n] ωo : frequency
Sinusoidal signal
𝐴𝐴: amplitude
𝑥𝑥 𝑛𝑛 = Acos 𝜔𝜔o 𝑛𝑛 + 𝜃𝜃 �𝜔𝜔o : frequency
𝜃𝜃: phase
23
2.5 Discrete-time Harmonics and Sinusoids
Analog freq. vs. Digital freq.
x(t ) = A cos(2πft + θ ) or A cos(ωt + θ )
t n⋅ts n
Sampling
t by ts = 1/ S (S =samples/sec)
0 ts 2ts 3ts
𝑓𝑓
𝑥𝑥 𝑛𝑛 = 𝐴𝐴cos 2𝜋𝜋𝜋𝜋𝜋𝜋𝑡𝑡𝑠𝑠 + 𝜃𝜃 = 𝐴𝐴cos 2𝜋𝜋𝜋𝜋 + 𝜃𝜃 = 𝐴𝐴cos 2𝜋𝜋𝜋𝜋𝜋𝜋 + 𝜃𝜃
S
Analog: 𝑡𝑡 sec → 𝑓𝑓 cycles/sec → 𝜔𝜔 = 2𝜋𝜋𝜋𝜋 rad/sec
𝑓𝑓
Digital: 𝑛𝑛 ⋅ → 𝐹𝐹 = 𝑓𝑓ts = cycles/sample → Ω = 2𝜋𝜋𝜋𝜋 rad/sample
𝑆𝑆
24
Example: Digital frequency
𝑓𝑓 = 100 Hz
8 samples/cycle
𝑡𝑡𝑠𝑠 =?
𝐹𝐹 = 𝑓𝑓𝑡𝑡𝑠𝑠 =?
𝑓𝑓 = 100 Hz
1 sample/cycle
𝑡𝑡𝑠𝑠 =?
𝐹𝐹 = 𝑓𝑓𝑡𝑡𝑠𝑠 =?
25
Analog vs. Digital Signals
t
0 ts 2ts 3ts
26
Sampling – How fast?
Consider a pure sine wave of frequency 100Hz:
𝑥𝑥 𝑡𝑡 = A𝑠𝑠𝑠𝑠𝑠𝑠 2π𝑓𝑓𝑓𝑓 + 𝜃𝜃
In order to ensure that we retain all of the information in
the signal, what sampling rate should be used? (no
quantization)
27
Sampling – Too fast ?
(1) Sampling at fs = 800Hz, i.e., 8 samples per period:
“Reasonable”
(2) Sampling at fs = 3,000Hz, i.e., 30 samples per period:
“Redundant”
28
Sampling – Too slow?
(3) Sampling at fs = 100Hz, i.e., 1 sample per period:
Signal
interpreted as
DC
(4) Sampling at fs = 80Hz, i.e., 1 sample per 1.25 period:
Most signal
features are
missed
29
2.6 The Sampling Theorem
Sampling rate or sampling frequency, fs (Hz) : the speed
at which an ADC generates the samples.
Sampling interval or sampling period, ts (sec): the time
between samples.
1
ts =
fs
What is the appropriate sampling frequency or
sampling period not to lose signal information?
Sampling theorem
30
Signal Frequency Range Terminology
Baseband signal:
the lowest signal frequency present is around 0 Hz :
fb : bandwidth
Bandlimited signal:
for all frequencies in the signal fl < f < fh :
31
Illustration of Sampling
Time domain Frequency domain
𝑥𝑥(𝑡𝑡) 𝑋𝑋(𝑓𝑓)
𝑡𝑡 𝑓𝑓
0 −𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 0 𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚
𝑠𝑠(𝑡𝑡) 𝑆𝑆(𝑓𝑓)
𝑡𝑡𝑠𝑠 1/𝑡𝑡𝑠𝑠 = 𝑓𝑓𝑠𝑠
⋯ ⋯ ⋯ ⋯
𝑡𝑡 𝑓𝑓
0 0
𝑥𝑥(𝑡𝑡) × 𝑠𝑠(𝑡𝑡) 𝑋𝑋 𝑡𝑡 ∗ 𝑆𝑆(𝑓𝑓)
1/𝑡𝑡𝑠𝑠 = 𝑓𝑓𝑠𝑠
⋯ ⋯ ⋯ ⋯
𝑡𝑡 𝑓𝑓
0 −𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 0 𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 32
Illustration of Sampling
𝑋𝑋 𝑡𝑡 ∗ 𝑆𝑆 𝑓𝑓
⋯ ⋯
𝑓𝑓
−1/𝑡𝑡𝑠𝑠 = −𝑓𝑓𝑠𝑠 −𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 0 𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 1/𝑡𝑡𝑠𝑠 = 𝑓𝑓𝑠𝑠
𝑓𝑓𝑠𝑠 − 𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚
Appropriate sampling frequency ?
𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚 < 𝑓𝑓𝑠𝑠 − 𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚
𝑓𝑓𝑠𝑠 < 2𝑓𝑓𝑚𝑚𝑚𝑚𝑚𝑚
33
“Suitable” Sampling Rate
Nyquist’s Sampling Theorem :
f s ≥ 2 × f max
where fmax is the maximum frequency component of a
baseband, bandlimited signal.
fmax = 100Hz
36
Nyquist Sampling Rate
If we require to sample the signal and retain all
information, then the sampling rate, fs must be chosen as:
fs > fN = 2fb
This frequency (2fb) is referred to as the Nyquist sampling
rate.
37
Aliasing
What if fs < 2fb ?
𝑋𝑋 𝑡𝑡 ∗ 𝑆𝑆 𝑓𝑓
⋯ ⋯
𝑓𝑓
−𝑓𝑓𝑠𝑠 − 𝑓𝑓𝑏𝑏 −𝑓𝑓𝑠𝑠 −𝑓𝑓𝑠𝑠 + 𝑓𝑓𝑏𝑏 −𝑓𝑓𝑏𝑏 0 𝑓𝑓𝑏𝑏 𝑓𝑓𝑠𝑠 − 𝑓𝑓𝑏𝑏 𝑓𝑓𝑠𝑠 𝑓𝑓𝑠𝑠 + 𝑓𝑓𝑏𝑏
⋯ ⋯
𝑓𝑓
−𝑓𝑓𝑠𝑠 −𝑓𝑓𝑏𝑏 0 𝑓𝑓𝑏𝑏 𝑓𝑓𝑠𝑠
38
Aliasing
When a (baseband) signal is sampled at a frequency
below the Nyquist rate, then we “lose” the signal
frequency information and aliasing is said to have
occurred.
fb = 100Hz
fs = 80Hz
fa = 20Hz
fb = 9000Hz
fs = 10000Hz
fa = 1000Hz
39
Aliased Spectra
40
Quantization
• If the ADC has finite precision due to a limited number of discrete
levels, then there may be a small error associated with each sample.
𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟
𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄 𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿𝐿 𝑄𝑄 = (n: #of bits)
2𝑛𝑛 − 1
𝑄𝑄
𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄𝑄 𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸𝐸 Δ𝑞𝑞 =
2
46
Reproducing an Analog Signal
Using a DAC at an appropriate sampling rate, we can reproduce an
analog signal:
The output is a staircase by the zero order hold.
A zero order circuit is a form of capacitive element whereby the input
voltage is held constant for one sampling period.
This artifact can however be removed by a reconstruction filter.
47
First Order Hold
Alternatively, a first order hold could be attempted in the
DAC. The voltage between two discrete samples is
approximated by a straight line.
Implementation of a first order circuit is not trivial.
48
Anti-aliasing Filter
Prior to ADC, all frequencies above fs/2 must be blocked
or they will be interpreted as lower frequencies, i.e.,
aliasing:
Anti-alias filter is analog (box-car filter), cutting off just
after fs/2.
49
Signal Aliasing
Without an anti-alias filter, frequencies above fs/2 will “alias” to
lower frequencies and interfere with the baseband signal.
Music signal sampled at fs=8kHz with NO anti-alias filter used :
Frequencies of the music and speech above 4kHz alias down to the
0-4kHz baseband and manifest as (correlated) noise.
50
Reconstruction Filter
Analog reconstruction filter at the output of a DAC
removes the baseband image high frequencies present
in the signal:
Staircase output
Analog voltage
from DAC
51
Real World Sampling Frequency
To sample a real-world signal, an appropriate sampling rate is
chosen according to quantitative and qualitative constraints.
Quantitative constraints will be specified by a domain expert, usually
in terms of the Nyquist rate.
Qualitative constraints usually refer to acceptable quality.
When digital signal sampled at fs is reconstructed, no frequency
components above fs /2 exist.
CD Audio: 44,100Hz
Professional Digital Audio: 48,000Hz
Teleconferencing: 16,000Hz
Telephone Speech: 8,000Hz
Biomedical: 1,000Hz
Control Systems: 100Hz
52
Real World Bit Rates
To sample a real-world signal, a suitable data wordlength, is also
chosen according to quantitative and qualitative constraints.
Quantitative constraints will be specified by a domain expert, usually
in terms of required SNR.
Qualitative constraints usually refer to acceptable quality.
When digital signal is sampled, quantized, and then reproduced, the
signal will have quantization noise present.
CD Audio: 16 bits
Professional Digital Audio: 24 bits
Teleconferencing: 12-16 bits
Telephone Speech: 8-13 bits
Biomedical: 16-24 bits
Control Systems: 4-10 bits
53
Summary of Ch 2.
Basic terms and definitions for discrete signals
Fundamental concepts and operations for
discrete signals
Decimation and interpolation
Analog freq vs. Digital freq
Sampling theorem
Aliasing
59