CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
1. The Difference Equation and the Digital Filtering
Consider a DSP system in the form of an LTI system as shown in the figure below
Digital Input
An LTI
System
π(π)
Digital Output
π(π)
The relationship between its input and output can be expressed in the form of a
difference equation as,
π(π) = ππ π(π) + ππ π(π β π) + β― + ππ΄ π(π β π΄)
βππ π(π β π) β ππ π(π β π) β β― β ππ΅ π(π β π΅)
(1)
where ππ , π β€ π β€ π΄ and ππ , π β€ π β€ π΅ represent the coefficients of the system
and π is the time index. This equation can also be written as
π΄
π΅
π(π) = β ππ π(π β π) β β ππ π(π β π)
π=π
(2)
π=π
The equation shows that the current value of the output π(π) depends on the
current π(π) and past values π(π β π), π(π β π), β¦ , π(π β π΄) of the input as
well as the past values π(π β π), π(π β π), β¦ , π(π β π΅) of the output.
We have already seen that a system expressed in this form of difference
equation fulfills the conditions of linearity, time-invariance and causality.
If the initial conditions are given, the system output (i.e. time response), π(π),
can be obtained recursively (illustrated below by the examples). This process is
called digital filtering.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Example 1
Compute the system output
π(π) = π. π π(π β π) + π(π β π)
for the first four samples using the following initial conditions
(a) Initial conditions: π(βπ) = π, π(βπ) = π, π(βπ) = βπ, and input
π(π) = (π. π)π π(π).
(b) Zero initial conditions: π(βπ) = π, π(βπ) = π, π(βπ) = π, and input
π(π) = (π. π)π π(π).
Solution
(a) Setting π = π, and using the initial conditions, we obtain the input and
output as
π(π) = (π. π)π π(π) = π
π(π) = π. π π(βπ) + π(βπ) = π. π × π β π = βπ. π
Setting π = π, and using the initial conditions, we obtain the input and output
as
π(π) = (π. π)π π(π) = π. π
π(π) = π. π π(βπ) + π(π) = π. π × π + π = π. π
Setting π = π, and using the past values of the input and output,
π(π) = (π. π)π π(π) = π. ππ
π(π) = π. π π(π) + π(π) = π. π × (βπ. π) + π. π = π. ππ
Setting π = π, and using the past values of the input and output,
π(π) = (π. π)π π(π) = π. πππ
π(π) = π. π π(π) + π(π) = π. π × π + π. ππ = π. ππ
Clearly, it can be seen that the further value of the output can be obtained
recursively.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
(b) Setting π = π, and using the initial conditions, we obtain the input and
output as
π(π) = (π. π)π π(π) = π
π(π) = π. π π(βπ) + π(βπ) = π. π × π + π = π
Setting π = π, and using the initial conditions, we obtain the input and output
as
π(π) = (π. π)π π(π) = π. π
π(π) = π. π π(βπ) + π(π) = π. π × π + π = π. π
Setting π = π, and using the past values of the input and output,
π(π) = (π. π)π π(π) = π. ππ
π(π) = π. π π(π) + π(π) = π. π × π + π. π = π. π
Setting π = π, and using the past values of the input and output,
π(π) = (π. π)π π(π) = π. πππ
π(π) = π. π π(π) + π(π) = π. π × π + π. ππ = π. ππ
Clearly, it can be seen that the further value of the output can be obtained
recursively.
Example 2
Compute the DSP system output
π(π) = ππ(π) β ππ(π β π) β π. π π(π β π) β π(π β π)
with the initial conditions π(βπ) = π, π(βπ) = π, π(βπ) = βπ, and input
π(π) = (π. π)π π(π).
(a) Compute the system response π(π) for 20 samples using MATLAB.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Solution
A MATLAB program to compute the system response for 20 samples is given
below along with the corresponding output shown in graphical form.
%
%
%
%
%
%
%
%
Example 2
Compute the response y(n) of a DSP system expressed by
y(n)=2x(n)-4x(n-1)-0.5y(n-1)-y(n-2)
for the first 20 samples. Initial conditions are
y(-2)=1, y(-1)=0, x(-1)=-1 and the system input is
x(n)=(0.8)^n*u(n).
% Initialize the input and output vectors
xi = [0 -1]; % for n=-2 and n=-1
yi = [1 0]; % for n=-2 and n=-1
%
n
%
x
%
x
Compute time indices
= 0:1:19;
Compute the input samples x(n) for these time instants n
= (0.8).^n;
Include the initial values of input into this vector
= [xi x];
% Now compute the system response
y = [];
% an empty vector
y = [yi y];
% after including the initial conditions
% compute y(n) recursively
for k = 3:1:22
r = 2*x(k-2)-4*x(k-1)-0.5*y(k-1)-0.5*y(k-2);
y = [y r];
end
subplot(2,1,1), stem(n,x(3:22),'filled','LineWidth',2), grid on
xlabel('Sample number'); ylabel('Input x(n)');
subplot(2,1,2), stem(n,y(3:22),'filled','LineWidth',2), grid on
xlabel('Sample number'); ylabel('Output x(n)');
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Input x(n)
1
0.5
0
0
2
4
6
8
10
12
Sample number
14
16
18
20
0
2
4
6
8
10
12
Sample number
14
16
18
20
Output x(n)
5
0
-5
-10
Figure 2: Plots of the input and system output for Example 2.
There are two MATLAB functions (syntax given below), that can used to perform
this filtering process:
Zi = filtic(B, A, Yi, Xi)
y = filter(B, A, x, Zi)
where B and A are vectors for the coefficients given as
π¨ = [π ππ ππ β¦ ππ΅ ] and π© = [ ππ ππ ππ β¦ ππ΄ ]
Xi and Yi are the vectors containing the initial conditions. Also x, y are the input
and system output vectors.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
The function filtic is used to obtain the initial states required by the second
function filter. The function filter is based on the direct-form II realization to
implement a digital filter from its difference equation form. This will be studied
in a coming lecture.
The following MATLAB code, illustrates how to solve Example 1, using filtic and
filter MATLAB functions.
>> B = [0 1];
>> A = [1 0 -0.5];
>> Xi = [-1 0];
>> Yi = [0 1];
>> Zi = filtic(B, A, Yi, Xi);
>> n = 0:3;
>> x = (0.5).^n;
>> y = filter(B, A, x, Zi)
y=
-0.5000 1.0000 0.2500 0.7500
These are the same results as obtained in Example 1.
2. The Difference Equation and the Transfer Function
From Equation 1, we have
π(π) = ππ π(π) + ππ π(π β π) + β― + ππ΄ π(π β π΄)
βππ π(π β π) β ππ π(π β π) β β― β ππ΅ π(π β π΅)
Assuming that all initial conditions for this system are zero, we take the ztransform of both sides to get
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
π(π) = ππ πΏ(π) + ππ πβπ πΏ(π) + β― + ππ΄ πβπ΄ πΏ(π)
βππ πβπ π(π) β ππ πβπ π(π) β β― β ππ΅ πβπ΅ π(π)
(3)
We have made use of the shift-theorem in the above equation. Rearranging, we
obtain
π(π) ππ + ππ πβπ + β― + ππ΄ πβπ΄ π©(π)
π―(π) =
=
=
πΏ(π)
π + ππ πβπ + β― + ππ΅ πβπ΅
π¨(π)
(4)
where π―(π) is defined as the z-transfer function with its numerator and
denominator polynomials given by
π©(π) = ππ + ππ πβπ + β― + ππ΄ πβπ΄
(5)
π¨(π) = π + ππ πβπ + β― + ππ΅ πβπ΅
(6)
It can clearly be notices that the z-tranfer function is the ratio of the z-transform
of the output with the z-transform of the input. This can diagrammatically be
shown as
The z-transfer function can be used to determine the stability and frequency
response of the digital filter.
Example 3
A DSP system is described by the following difference equation
π(π) = π(π) β π(π β π) β π. ππ(π β π) β π. πππ(π β π)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Find the z-transfer function π―(π), the denominator polynomial π¨(π), and the
numerator polynomial π©(π).
Solution
Taking the z-transform of both sides of the given difference equation, and using
the shift-theorem, we get
π(π) = πΏ(π) β πβπ πΏ(π) β π. ππβπ π(π) β π. πππβπ π(π)
It can also be written as
π(π) + π. ππβπ π(π) + π. πππβπ π(π) = πΏ(π) β πβπ πΏ(π)
π(π)(π + π. ππβπ + π. πππβπ ) = πΏ(π)(π β πβπ )
(π β πβπ )
π(π)
=
πΏ(π) (π + π. ππβπ + π. πππβπ )
The transfer function, is therefore, given by
(π β πβπ )
π(π)
π―(π) =
=
πΏ(π) (π + π. ππβπ + π. πππβπ )
The denominator and numerator polynomials are
π¨(π) = π + π. ππβπ + π. πππβπ
π©(π) = π β πβπ
Example 4
A digital system is described by the following difference equation
π(π) = π(π) β π. ππ(π β π) + π. πππ(π β π)
Find the z-transfer function π―(π), the denominator polynomial π¨(π), and the
numerator polynomial π©(π).
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Solution
Taking the z-transform of both sides of the given difference equation, and using
the shift-theorem, we get
π(π) = πΏ(π) β π. ππβπ πΏ(π) + π. πππβπ πΏ(π)
It can also be written as
π(π) = πΏ(π)(π β π. ππβπ + π. πππβπ )
π(π)
π
=
πΏ(π) (π β π. ππβπ + π. πππβπ )
The transfer function, is therefore, given by
π―(π) =
π(π)
π
=
πΏ(π) (π β π. ππβπ + π. πππβπ )
The denominator and numerator polynomials are
π¨(π) = π β π. ππβπ + π. πππβπ
π©(π) = π
In some DSP applications, the given transfer function of a digital system can be
converted into a difference equation for DSP implementation. The following
example illustrates this procedure.
Example 5
Convert each of the following transfer functions into its difference equation
(a) π―(π) =
(b) π―(π) =
ππ β π
ππ + π.π π + π.ππ
ππ β π.π π + π.ππ
ππ
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Solution
Part (a): We first divide the numerator and denominator by ππ to obtain the
transfer function whose numerator and the denominator polynomials have the
negative powers of π, it follows that
(ππ β π)/ππ
(π β πβπ )
π―(π) = π
=
(π + π. π π + π. ππ)/ππ (π + π. π πβπ + π. ππ πβπ )
According to the definition of the transfer function
π―(π) =
π(π)
πΏ(π)
Therefore, in this case,
(π β πβπ )
π(π)
=
πΏ(π) (π + π. π πβπ + π. ππ πβπ )
Cross multiplication gives
(π + π. π πβπ + π. ππ πβπ )π(π) = (π β πβπ )πΏ(π)
π(π) + π. π πβπ π(π) + π. ππ πβπ π(π) = πΏ(π) β πβπ πΏ(π)
Applying the inverse z-transform and applying the shift-theorem
π(π) + π. π π(π β π) + π. ππ π(π β π) = π(π) β π(π β π)
This equation can be re-arranged to give the required difference equation for
the DSP system, as
π(π) = π(π) β π(π β π) β π. π π(π β π) β π. ππ π(π β π)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Part (b): In this case also, we first divide the numerator and denominator by ππ
to obtain the transfer function whose numerator and the denominator
polynomials have the negative powers of π, it follows that
(ππ β π. π π + π. ππ)/ππ (π β π. π πβπ + π. ππ πβπ )
π―(π) =
=
(ππ )/ππ
π
According to the definition of the transfer function
π―(π) =
π(π)
πΏ(π)
Therefore, in this case,
π(π)
= (π β π. π πβπ + π. ππ πβπ )
πΏ(π)
It can be written as
π(π) = (π β π. π πβπ + π. ππ πβπ )πΏ(π)
π(π) = πΏ(π) β π. π πβπ πΏ(π) + π. ππ πβπ πΏ(π)
Applying the inverse z-transform and applying the shift-theorem
π(π) = π(π) β π. π π(π β π) + π. ππ π(π β π)
This is the required difference equation for the DSP system.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Transfer Function in Pole-Zero Form
From Equation 4, we know that the transfer function for a digital filter can be
written as
π(π) ππ + ππ πβπ + β― + ππ΄ πβπ΄ π©(π)
π―(π) =
=
=
πΏ(π)
π + ππ πβπ + β― + ππ΅ πβπ΅
π¨(π)
The numerator π©(π) and the denominator π¨(π) polynomials of the transfer
function π―(π) can be factorized. The transfer function π―(π) can therefore, be
written in its pole-zero form as
π―(π) =
ππ (π β ππ )(π β ππ ) β¦ (π β ππ΄ )
(π β ππ )(π β ππ ) β¦ (π β ππ΅ )
(7)
where the zerosππ and poles ππ can be found by solving (finding the roots of) the
polynomial equations
ππ΄ + (
ππ π΄βπ
ππ΄
+ β―+ ( ) = π
)π
ππ
ππ
ππ ππ΅ + ππ ππ΅βπ + β― + ππ΅ = π
This is explained with the following example.
Example 6
Given the following transfer function
(π β πβπ )
π―(π) =
(π + π. ππβπ + π. πππβπ )
Convert it into its pole-zero form.
Solution
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
We first multiply the numerator and denominator by ππ to obtain the transfer
function whose numerator and the denominator polynomials have the positive
powers of π, as follows
(π β πβπ ) ππ
ππ β π
π―(π) =
=
(π + π. ππβπ + π. πππβπ ) ππ ππ + π. ππ + π. ππ
Putting the numerator polynomial equal to zero and then finding the roots,
gives us the zeros of the transfer function,
ππ β π = π
(π β π)(π + π) = π
Therefore, we get ππ = π and ππ = βπ as the roots.
Now, setting the denominator polynomial equal to zero and find the roots, gives
us the poles of the transfer function,
ππ + π. ππ + π. ππ = π
π=
βπ. π ± β(π. π)π β π(π)(π. ππ) βπ. π ± βπ. ππ β π. ππ
=
π(π)
π
βπ. π ± βπ. ππ βπ. π ± π. π
=
=
= βπ. π, βπ. π
π
π
Therefore, the poles are ππ = βπ. π and πππ = βπ. π. The transfer function can
now be written in the pole-zero form as
π―(π) =
(π β π)(π + π)
(π + π. π)(π + π. π)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Impusle Response, Step Response and System Response
Example 6.7
Given a transfer function depicting a DSP system
π―(π) =
π+π
π β π. π
Determine
(a) The impulse response π(π)
(b) The step response π(π), and
(c) The system response π(π), if the input is given as π(π) = (π. ππ)π π(π).
Solution
Part (a): In this case π(π) = πΉ(π), thus πΏ(π) = π. As
π―(π) =
π(π)
πΏ(π)
Therefore, in this case, the z-transform of the output is equal to the transfer
function:
π―(π) = π(π)
By taking the inverse z-transform of the transfer function we can find out the
unit impulse response π(π) of the system. The transfer function can be written
as
π―(π)
π+π
=
π
π(π β π. π)
This can further be written in the form of partial fractions as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
π―(π) π¨
π©
= +
π
π (π β π. π)
where
π¨=
π+π
π+π
=
= βπ
|
(π β π. π) π=π (π β π. π)
π©=
π+π
π. π + π
=
=π
|
π π=π.π
π. π
Thus we have
π―(π) βπ
π
=
+
(π β π. π)
π
π
Or
π―(π) = βπ +
ππ
(π β π. π)
Taking inverse z-transform of both sides (and using Table 5.1), we get
π(π) = βπ πΉ(π) + π(π. π)π π(π)
which is the required impulse response of the system.
Part (b): In this case π(π) = π(π), thus πΏ(π) =
π―(π) =
π
πβπ
. As
π(π)
πΏ(π)
Therefore, in this case,
π(π) = π―(π)πΏ(π) =
(π + π)
π
(π β π. π) (π β π)
It can be written as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
π(π)
π+π
=
(π β π. π)(π β π)
π
This can further be written in the form of partial fractions as
π(π)
π¨
π©
=
+
(π β π. π) (π β π)
π
where
π¨=
π+π
π. π + π
=
= βπ
|
(π β π) π=π.π (π. π β π)
π©=
π+π
π+π
=
=π
|
(π β π. π) π=π π β π. π
Thus we have
π(π)
βπ
π
=
+
(π β π. π) (π β π)
π
Or
π(π) =
βππ
ππ
+
(π β π. π) (π β π)
Taking inverse z-transform of both sides (and using Table 5.1), we get
π(π) = βπ(π. π)π π(π) + π π(π)
which is the required step response of the system.
Part (c): In this case π(π) = (π. ππ)π π(π), thus from Table 5.1, πΏ(π) =
π
πβπ.ππ
.
As
π―(π) =
π(π)
πΏ(π)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Therefore, in this case,
π(π) = π―(π)πΏ(π) =
(π + π)
π
(π β π. π) (π β π. ππ)
It can be written as
π(π)
π+π
=
(π β π. π)(π β π. ππ)
π
This can further be written in the form of partial fractions as
π(π)
π¨
π©
=
+
(π β π. π) (π β π. ππ)
π
where
π¨=
π+π
π. π + π
π. π
=
=
=π
|
(π β π. ππ) π=π.π (π. π β π. ππ) π. ππ
π©=
π+π
π. ππ + π
π. ππ
=
=
= βπ
|
(π β π. π) π=π.ππ π. ππ β π. π βπ. ππ
Thus we have
π(π)
π
βπ
=
+
(π β π. π) (π β π. ππ)
π
Or
π(π) =
ππ
ππ
β
(π β π. π) (π β π. ππ)
Taking inverse z-transform of both sides (and using Table 5.1), we get
π(π) = π(π. π)π π(π) + π (π. ππ)π π(π)
which is the required system response.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 19
Date: November, 2012
Table 5.1 Table of z-transform pairs (for causal sequences)
Line
No.
Signal
π(π),
πβ₯π
z-Transform
π(π(π)) = πΏ(π)
Region of
Convergence
β
1
β π(π) πβπ
π(π)
π=π
2
πΉ(π)
3
π π(π)
4
π π(π)
5
ππ π(π)
6
ππ π(π)
7
πβππ π(π)
8
π ππ π(π)
9
π¬π’π§(ππ) π(π)
10
ππ¨π¬(ππ) π(π)
11
ππ π¬π’π§(ππ) π(π)
12
ππ ππ¨π¬(ππ) π(π)
13
πβππ π¬π’π§(ππ) π(π)
14
πβππ ππ¨π¬(ππ) π(π)
15
π|π¨||π·|π πππ(ππ½ + π) π(π) where π·
and π¨ are complex constants defined by
π· = |π·|β π½, π¨ = |π¨|β π
Shift Theorem:
1
Entire z-plane
ππ
πβπ
π
(π β π)π
|π| > 1
|π| > 1
π(π + π)
(π β π)π
π
πβπ
π
π β πβπ
ππ
(π β π)π
ππ
|π| > 1
|π| > |π|
|π| > πβπ
|π| > |π|
π π¬π’π§(π)
β ππ ππ¨π¬(π) + π
|π| > |π|
π (π β ππ¨π¬(π))
ππ β ππ ππ¨π¬(π) + π
[π π¬π’π§(π)] π
ππ β [ππ ππ¨π¬(π)]π + ππ
π [π β π ππ¨π¬(π)]
ππ β [ππ ππ¨π¬(π)]π + ππ
[πβπ π¬π’π§(π)] π
ππ β [ππβπ ππ¨π¬(π)]π + πβππ
π [π β πβπ ππ¨π¬(π)]
ππ β [ππβπ ππ¨π¬(π)]π + πβππ
|π| > |π|
|π| > |π|
|π| > |π|
|π| > πβπ
|π| > πβπ
π¨π
π¨β π
+
π β π· π β π·β
π(π(π β π)) = πβπ π(π(π))
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
© Copyright 2026 Paperzz