You are on page 1of 35

Digital Signal Processing ECR305_L3

Lecture – 3 Objectives

xn  yn 
Discrete-Time
System

Discrete-Time To learn & understand


 The fundamental concepts of
Systems discrete-time systems
IUB Dr. Abdur Razzak 1
Discrete-time systems ECR305_L3

Mathematically, a discrete-time system (discrete system) is


described by an operator T[] or L[] that takes a sequence x(n)
(called excitation) and transform it into another sequence y(n)
(called response).

yn  T xn  Lxn

xn  yn 
Discrete-Time
System

In DSP, it is a system that process an input signal into an output


signal.

IUB Dr. Abdur Razzak 2


Classification of discrete systems ECR305_L3

Discrete systems are broadly classified as follows:

 Linear versus nonlinear systems

 Time-invariant versus time-varying systems

 Static versus dynamic systems

 Casual versus non-casual systems

 Stable versus unstable systems

 Recursive versus non-recursive systems

IUB Dr. Abdur Razzak 3


Classification of discrete systems (contd..) ECR305_L3

Static versus dynamic systems


 A system is said to be static if its output at any instance n depends
only on the input sample at the same instance but not on the past
or future samples.

yn   nxn  yn   axn   bx 2 n 

Casual versus non-casual systems


 A system is said to be casual if the output of the system at any
time n depends only on present [e.g. x(n)] and past inputs [e.g.
x(n-1), x(n-2) etc.] but does not depends on future inputs [e.g.
x(n+1), x(n+2) etc.].
yn  F xn, xn  1, xn  2,  
IUB Dr. Abdur Razzak 4
Classification of discrete systems (contd..) ECR305_L3

Stable versus unstable systems


 A system is said to be BIBO stable if and only if every bounded
input produces a bounded output.
xn  M x   yn  M y  

 An LTI system is stable if it’s impulse response is absolutely


summable. 

 hk   
k 0

Recursive versus non-recursive systems


 A system is said to be recursive if the output of the system at any
instance n depends not only on the input at that instance but also
on the past output.
yn  yn  1  xn
IUB Dr. Abdur Razzak 5
Recursive system ECR305_L3

Block diagram of a
simple recursive
system
yn  ayn  1  xn 

y 0  ay  1  x0 
y 1  ay 0  x1  a 2 y  1  ax0  x1
y 2   ay 1  x2   a 3 y  1  a 2 x0  ax1  x2
:
y n   a n 1 y  1  a n x0   a n 1 x1  a n  2 x2       axn  1  xn 
n
 a n 1 y  1  
k 0
a k xn  k , n0

IUB Dr. Abdur Razzak 6


Linear systems ECR305_L3

A discrete system T[] is a linear operator L[] if and only if L[]


satisfy the principle of superposition, namely
La1 x1 n  a2 x2 n  a1Lx1 n  a2 Lx2 n
The output y(n) of a linear system to an arbitrary input x(n) is
given by

yn   Lxn    xk L n  k 
n  

L[(n–k)] is the response of a unit sample at time k, and is called


an impulse response denoted by h(n,k). Then (11) can be
rewritten as 
yn    xk hn, k 
n  

IUB Dr. Abdur Razzak 7


Linear time-invariant (LTI) systems ECR305_L3

A linear system in which an input-output pair, x(n) and y(n), is


invariant to a shift k in time is called a linear time-invariant (LTI)
system.
y n   Lxn 
 Lxn  k   yn  k 

The impulse response of an LTI system is given by h(n). The


mathematical operation in

yn   LTI xn    xk hn  k 
k  

is called a linear convolution sum and is denoted by

yn   xn hn


IUB Dr. Abdur Razzak 8
Linear time-invariant systems (contd..) ECR305_L3

Linear time-invariant systems are two types:

 Finite-duration impulse response (FIR) systems

M 1
y n    hk xn  k 
k 0

 Infinite-duration impulse response (IIR) systems


y n    hk xn  k 
k 0

IUB Dr. Abdur Razzak 9


Some other systems ECR305_L3

xn  Identity system yn   xn 

xn  Unit delay system yn  xn  1

xn  Unit advance system yn  xn  1

xn  Median filter yn  medianxn  1, xn, xn  1

xn  Moving average filter y n  


1
xn  1  xn   xn  1
3
xn  Accumulator yn  x      xn  2  xn  1  xn

IUB Dr. Abdur Razzak 10


Example-1 ECR305_L3

Determine whether the following systems are linear or nonlinear:


(1) yn   nxn  (2) yn   x 2 n  (3) yn   e x n 

Solution:

(1) y1 n   nx1 n  and y2 n   nx2 n 


A linear combinatio n of the two input sequences results in the output
y3 n   La1 x1 n   a2 x2 n   na1 x1 n   a2 x2 n 
Now, a linear combinatio n of the two outputs result in the output
a1 y1 n   a2 y2 n   a1nx1 n   a2 nx2 n 
The right hand side of the above 2 equations are identical, hence

The system is linear.


IUB Dr. Abdur Razzak 11
Example-1 (contd..) ECR305_L3

(2)
y1 n   x12 n  and y2 n   x22 n 
A linear combinatio n of the two input sequences results in the output
y3 n   La1 x1 n   a2 x2 n   a1 x1 n   a2 x2 n 
2

Now, a linear combinatio n of the two outputs result in the output


a1 y1 n   a2 y2 n   a1 x12 n   a2 x22 n 
The right hand side of the above 2 equations are not identical, hence
The system is non-linear.

(3) if xn  0 then yn  1


This is an indication that the system is non-linear.

IUB Dr. Abdur Razzak 12


Example-2 ECR305_L3

Determine the response of the following systems to the input


signal: xn      0,3,2,1,0,1,2,3,0,  

(1) unit delay system (2) moving average filter (3) median filter

Solution: (1) Unit delay system: yn   xn  1     0,3,2,1,0,1,2,3,0,  



(2) Moving average filter: y n   1 xn  1  xn   xn  1
3
 5 2 5 
    0,1, ,2,1, ,1,2, ,1,0,  
 3 3 3 

(3) Median filter:

y  n   median  x  n  1 , x  n  , x  n  1   0, 2, 2,1,1,1, 2, 2, 0, 0, 0, 


IUB Dr. Abdur Razzak 13
Impulse response of LTI systems ECR305_L3

The impulse response of an LTI system is given by h(n). The


mathematical operation in

y n   LTI xn    xk hn  k 
k  

is called a linear convolution sum and is denoted by

yn   xn hn

In case of unit impulse response of an LTI system



y  n   LTI  x  n     x k  h n  k 
k 

IUB Dr. Abdur Razzak 14


Example-3 ECR305_L3

Consider a special case of a finite-duration sequence given as


xn   2,1,0,3

Resolve the sequence x(n) into a sum of weighted impulse
sequences.
 2
Solution: x n    xk  n  k    xk  n  k 
k   k  1

 x  1 n  1  x 0 n   0  x 2  n  2 

 2 n  1   n   3 n  2 

IUB Dr. Abdur Razzak 15


Convolution ECR305_L3

An LTI system is completely characterized in the time domain by


the impulse response h(n) as
xn  h(n)  yn  hn xn
The convolution operation mentioned above is used to describe
the response of an LTI system. In DSP, it is an important
operation and has many other uses.

If the sequences are mathematical functions (of finite or infinite


duration), then we can analytically evaluate x(n)*h(n) for all n to
obtain a functional form of y(n).

y n    xk hn  k 
k  

IUB Dr. Abdur Razzak 16


Convolution (contd..) ECR305_L3

The process of computing the convolution between x(k) and h(k)


involves the following four steps:

1. Folding: Fold h(k) about k = 0 to obtain h(-k).

2. Shifting: Shift h(-k) by n to the right (left) if n is positive


(negative), to obtain h(n-k).

3. Multiplication: Multiply x(k) by h(n-k) to obtain the


product sequence x(k) h(n-k).

4. Summation: Sum all the values of the product sequence


x(k) h(n-k) to obtain the value of the output at time n.

IUB Dr. Abdur Razzak 17


Example-4 ECR305_L3

The impulse response of a linear time invariant system is


hn   1,2,1,1

Determine the system response to the input signal xn   1,2,3,1
Solution:
 

h k    1,1,2,1 y 0   xk h0  k    xk h k   2  2  4
k   k  


h1  k    1,1,2,1 y 1   xk h1  k   1  4  3  8
k  


h2  k    1,1,2,1 y 2   xk h2  k   1  2  6  1  8
k  

h3  k   0,1,1,2,1 
y 3   xk h3  k   0  2  3  2  3
 k  
IUB Dr. Abdur Razzak 18
Example-4 (contd..) ECR305_L3


h4  k   0,0,1,1,2,1 y 4   xk h4  k   0  0  3  1  2
k  


h5  k   0,0,0,1,1,2,1 y 5   xk h5  k   0  0  0  1  1
k  

h 1  k    1,1,2,1 y 1  1 yn  0 for n  5 and n  1


y n    xk hn  k 
k  

    ,0,0,1,4,8,8,3,2,1,0,0,   

IUB Dr. Abdur Razzak 19
Example-5 ECR305_L3

Determine the unit step response for the LTI system with impulse
response h(n) = anu(n). Also determine the condition in order to
be the system stable.
Solution: 1 for n  0
Given that xn   u n   
0 for n  0
So 
y n    u k hn  k    a n  k
n

k   k 0

n 1

yn   1  a  a 2      a n 
For n > 0 1 a
1 a
For n < 0 yn  0
in order to be system stable a 1
IUB Dr. Abdur Razzak 20
Crosscorrelation ECR305_L3

Correlation is an operation used in many applications in digital


signal processing. It is a measure of degree to which two
sequences are similar.

Given two real-valued sequences x(n) and y(n) of finite energy,


the crosscorrelation of x(n) and y(n) is a sequence rxy(l) is defined
by
 
rxy l    xn  y n  l  or rxy l    xn  l  y n 
n   n  

The index l is called the shift or lag parameter. Similarly,


 
ryx l    y n xn  l  ryx l    y n  l xn 
n   n  

Hence rxy l   ryx  l 


IUB Dr. Abdur Razzak 21
Autocorrelation ECR305_L3

The special case of above relation when x(n) and y(n) is called
the autocorrelation and is defined by


rxx l    xn xn  l 
n  


rxx l    xn  l xn 
n  


ryy l    y n  y n  l 
n  


ryy l    y n  l  y n 
n  

IUB Dr. Abdur Razzak 22


Example-6 ECR305_L3

Determine the crosscorrelation of the following two sequences:


xn    1, 2, 4  and y n    1, 1, 1, 1 
Solution:  
 
rxy l    xn  y n  l  rxy 0   xn  y n   1  2  4  0  7
n   n  

xn    1, 2, 4  and y n  1   0, 1, 1, 1, 1 
 

rxy 1   xn  y n  1  0  2  4  0  0  6
n  

xn    1, 2, 4  and y n  2   0, 0, 1, 1, 1, 1 
 
IUB Dr. Abdur Razzak 23
Example-6 (contd..) ECR305_L3


rxy 2   xn  y n  2  0  0  4  0  0  0  4
xn    1, 2, 4 
n  
and
 
rxy  1   xn  y n  1  0  1  2  4  0  7
y n    1, 1, 1, 1  n  

 xn    1, 2, 4  and y n    1, 1, 1, 1 
 

xn    1, 2, 4  and rxy  2   xn  y n  2  0  0  1  2  0  0  3
n  
 
y n    1, 1, 1, 1  rxy  3   xn  y n  3  0  0  0  1  0  0  1
n  

rxy  l   , 0,1,3, 7, 7, 6, 4, 0, 

IUB Dr. Abdur Razzak 24


Example-7 ECR305_L3

Determine the autocorrelation of the following signal:


xn    1, 2, 1, 1 
Solution: 

IUB Dr. Abdur Razzak 25


Difference equation ECR305_L3

An LTI discrete system can also be described by a linear constant


coefficient difference equation of the form
N M

 a yn  k   b xn  m
k 0
k
m 0
m

Another form of the above equation, with a0 = 1, is


M N
yn    bm xn  m   ak yn  k 
m 0 k 1

A solution to this equation can be obtained in the form

y n   y zi n   y zs n 
 zero  input response  zero - state response
IUB Dr. Abdur Razzak 26
Assignment-3 (due on next class) ECR305_L3

Problems: 2.39, 2.40, 2.41. 2.54, 2.55, 2.62

IUB Dr. Abdur Razzak 27


MATLAB implementation ECR305_L3

MATLAB
Examples

IUB Dr. Abdur Razzak 28


MATLAB implementation (difference equation) ECR305_L3

A function called filter is available to solve difference equation


numerically, given the input and the difference equation
coefficients. In its simplest form this function is invoked by

y  filter(b, a, x)
b  [b 0, b 1,.......,bM);
a  [a 0, a 1,.......,aN);

To compute and plot impulse response of the filter, MATLAB


provide the following function.

h  impz (b, a, n)

IUB Dr. Abdur Razzak 29


MATLAB example 2.5 ECR305_L3

Let x(n) = u(n) – u(n–10) be an input to an LTI system with


impulse response h(n) = (0.9)n u(n). Determine the output y(n).
Also plot x(n), h(n) and y(n) using MATLAB.

% Definition
n = -10:50; x = stepseq(0,-10,50)-stepseq(10,-10,50); h = ((0.9).^n).*(stepseq(0,-10,50));
% Calculation
y = conv(x,h);
%Plot
subplot(3,1,1);
stem(n,x); title('Rectangular pulse','fontsize',15); ylabel('x(n)','fontsize',15); axis([-10 50 0 1.5]);
subplot(3,1,2);
stem(n,h); title('Impulse response','fontsize',15); ylabel('h(n)','fontsize',15); axis([-10 50 0 1.5]);
subplot(3,1,3);
m = -10:0.5:50; stem(m,y); title('Output sequence','fontsize',15); axis([-10 50 0 10]);
xlabel('n','fontsize',15); ylabel('y(n)','fontsize',15);

IUB Dr. Abdur Razzak 30


MATLAB example 2.5 (contd..) ECR305_L3

IUB Dr. Abdur Razzak 31


MATLAB example 2.9 ECR305_L3

Given the following difference equation


yn  yn  1  0.9 yn  2  xn
(a) Calculate and plot the impulse response h(n) at n = -20,…,100
(b) Calculate and plot the step response s(n) at n = -20,…..…,100
a = [1, -1, 0.9]; b = [1]; n = [-20:100]; x = stepseq(0,-20,100);
h = impz(b,a,n); % For (a)
s = filter(b,a,x); % For (b)

subplot(2,1,1)
stem(n,h);
title('Impulse response'); ylabel('Value of h(n)');
subplot(2,1,2)
stem(n,s);
title('Step response'); xlabel('Value of n'); ylabel('Value of s(n)');

IUB Dr. Abdur Razzak 32


MATLAB example 2.9 (contd..) ECR305_L3

IUB Dr. Abdur Razzak 33


References ECR305_L3

1. John G. Proakis, Digital Signal Processing, Pearson, 4th


Edition, Seventh Impression, 2011. (pp. 53–146)

2. Vinay K. Ingle, and John G. Proakis, Digital Signal


Processing using MATLAB, Thomson Learning
Bookware Companion Series, 2007. (pp. 7–39)

IUB Dr. Abdur Razzak 34


Next class ECR305_L3

The z-transform

IUB Dr. Abdur Razzak 35

You might also like