BDSP Lecture 3
BDSP Lecture 3
Signal Processing
BDSP-513
Lecture 3
Note that precision of the data is based on the number of bits used in the DSP
system.
Notation for Digital Signals
› A digital signal x[n] may be modified by time shifts and
resampling.
For Example:
› Signal x[n-2], shifts x[n] two steps to the right
› Signal x[n+3], shifts x[n] three steps to the left
› Signal x[2n], selects every other sample from x[n]
› Signal x[3n], selects every third sample
4
Digital Functions
The basic digital functions (signal or sequence)
are:
› Power Function
› Exponential Function
5
Unit Impulse Function
The unit impulse function or unit sample sequence is defined
as the sequence with values.
0.8
0.6
k
0.4
0.2
0
-5 0 5 10
k
Unit Impulse Function
k 1, k0
Matlab Code
0, kUnitimpulse sequence
k1 = -5;
k2 = 10; 01
k = k1:k2;
0.8
x = (k==0); 0.6
k
stem(k, x) 0.4
0.2
xlabel('k')
ylabel('\delta_k') 0
title('Unit impulse
-5 0 5 10
sequence') axis([k1 k2 -0.1 k
1.1])
Unit Impulse Function
• The unit impulse function δ[n] has an amplitude of zero at all
samples except n = 0, where it has the value 1.
Answers:
a) δ[0] = 1
b) δ[3] = 0
c) δ[-2] = 0
Scaled Unit Impulse Function
a) x[n] = δ[n - 2]
b) x[n] = δ[n +
2]
Unit Impulse Function
Example: write a function to describe the signal in the figure.
u k 1, k 0
Matlab Code
0, k Unit step sequence
k1 = -5;
k2 = 10;
01
k = k1:k2; 0.8
x = (k>=0); 0.6
uk
0.4
stem(k, x)
0.2
xlabel('k')
ylabel('u_k') 0
title('Unit step sequence')
-5 0 5 10
axis([k1 k2 -0.1 1.1]) k
Shifted Unit Step Function
Example: Draw the signal x[n] = u[n - 2], and x[n] = u[n + 2]
Unit Step Function
Example:
Answer
Substituting n = (n – 3) gives
∞
𝑢(𝑛) ∑ 𝛿(𝑛 − 𝑚)
𝑚=0
19
Connection b/w Impulse and Step Functions
Example: write a function to describe the signal in the figure (2
solutions).
k1 = -5;
k2 = 10;
k = k1:k2;
Kp = (k>=0);
Kpp=Kp.*k
ur=Kpp;
stem(k, ur)
xlabel('k')
ylabel(‘u_r'
)
title('Unit Rampe sequence')
21
axis([k1 k2 –max(k) max(k)])
Power Function
› Power functions take the form:
x[n] = Aα βn
xe,k X e a k
Matlab Code xe,k = Xe ak
0.8
Xe = 0.8;
a = 0.75;
0.6
k1 = 0;
k2 = 10;
k = k1:k2; 0.4
xe
x = Xe*a.^k;
0.2
stem(k, x)
xlabel('k') 0
ylabel('x_e') 0 2 4 6 8 10
k
title('x_{e,k} = X_e a^k')
Exponential Function
› Exponential functions take the form:
x[n] = Ae βn
› Where e = 2.71828
› When β is positive, the function grows.
› When β is negative the function decays.
› When e is negative, the signal samples alternate positive and
negative.
› The value of A is determine the
magnitude/amplitude/value of the function when n = 0
24
Exponential Function
25
Sinusoidal Sequence
The sinusoidal functions take the form
subtracted, as required.
27
Composite Functions
𝒙 𝒏 = 𝜹 𝒏 + 𝜹 𝒏 − 𝟏 + 𝜹 𝒏 − 𝟐 + 𝜹[𝒏
− 𝟑]
28
Composite Functions
Example: Draw a signal x[n] = 0.5e-0.2nsin(nπ/9)u[n]
First draw three basic signals and then multiply to get the resultant
damped sinusoid signal as shown in the figure.
× =
29
II- Generation of Digital Signals
Example:
Solution
a)
30
Generation of Digital Signals
b) The first five sample values for part (1) are calculated
and plotted in the Figure.
31
Generation of Digital Signals
b) The first eight sample values for part (2) are calculated
and plotted in the Figure.
32
III- Linear, Time-Invariant, Causal Systems
› In this part, we
study:
– Linearity
– Time invariance
– Causality
Linear System
› The Linear system output due to the weighted sum inputs
∝𝑥1(𝑛) + 𝛽𝑥2(𝑛) is equal to the same weighted sum of the
individual outputs obtained from their corresponding inputs,
that is, 𝑦(𝑛) = ∝𝑦1(𝑛) + 𝛽𝑦2(𝑛), where ∝ and 𝛽 are constants.
35
Testing for Linearity
36
Testing for Linearity
Example
37
Time-Invariant System
38
Time-Invariant System
Example: Determine whether the linear
system y(𝑛) = 2𝑥(𝑛 − 5) is time
invariant.
39
Time-Invariant System
40
Causality and Stability
+¿
Causal System
Example: Determine whether the following systems are causal
or not.
Solution
1) Causal
2) Non-causal
43
BIBO System
› Example
Difference Equations and Impulse
Responses
Examples
Difference Equations and Impulse
Responses
conditions.
Difference Equations and Impulse
Responses
Example
Difference Equations and Impulse
Responses
Solution
Difference Equations and Impulse
Responses
Solution
Signal Shifting
n
01234 5
0 3 n
Time-advance
Advance “Happens earlier”
0 n
Time Reversal and Shifting
n
01234 5
0 n
Shifting
Folding &Shifting
n
Periodic Replication With Distortion
“Shift and
Period of
Add”
repetition is
smaller than the
duration of Distortion free
repeated zone
sequence
2. Choose one of the sequences, say h(k), and time-reverse it to form the
sequence h(-k).
4. Multiply the two sequences x(k) and h(n - k) and sum the product for all
values of k. The resulting value will be equal to y(n). This process is repeated
for all possible shifts, n.
Graphical Illustration of Convolution
Graphical Illustration of Convolution
Graphical Illustration of Convolution
Graphical Illustration of Convolution
Graphical Illustration of Convolution
No Overlap
for n < 0
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
Full Overlap
Graphical Illustration of Convolution
Full Overlap
Graphical Illustration of Convolution
Full Overlap
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
Partial Overlap
Graphical Illustration of Convolution
No Overlap
for n > 0
Summary of Graphical Illustration
Example
Solution: a) Graphical method
Solution
B- Using the table method
Solution
C- Using the convolution formula
Summary of Convolution Properties
Block
processing
Book Toolbox Functions