Lecture 2 - DTS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Lecture 2: Discrete-Time Signals and

Systems: Time-domain Approach


Lecturer: Dr Alessandro Varsi
A.Varsi@liverpool.ac.uk
Contents
▪ Discrete-time signal representations
▪ Difference Equations for LTI systems
▪ Impulse response
▪ Convolution
▪ Stability and Causality

2
DTS: Time-Domain Representation
• Signals are represented as sequences of
numbers, called samples.

• Sample value of a typical signal or sequence


denoted as x[n] with n being an integer in the
range −   n  

• x[n] defined only for integer values of n and


undefined for non-integer values of n.

• Discrete-time signal represented by {x[n]}


3
DTS: Time-Domain Representation-
Cont’d
• Graphical representation of a discrete-
time signal with real-valued samples

4
DTS: Time-Domain Representation-
Cont’d
• Block-diagram representation of the
sampling process

xa (t )
. . x[ n] = xa (t ) t = nT = xa ( nT )

n = , − 2, − 1,0,1,

T : Sampling interval or sampling period

fs: Sampling frequency: fs=1/T Typical value?

5
Basic Sequences
◼ Unit sample sequence: 1, n = 0
 [ n] = 
0, n  0

1, n  0
◼ Unit step sequence: u[n] = 
0, n  0

6
General Sequences
An arbitrary sequence can be represented in the
time-domain as a weighted sum of some basic
sequence and its delayed (advanced) versions

x[n] = 0.5 [n + 2] + 1.5 [n − 1] −  [n − 2]


+  [n − 4] + 0.75 [n − 6]
7
Discrete-Time Systems
A discrete-time system accepts a given input sequence
x[n] and processes it to generate an output
sequence y[n] with more desirable properties.
In most applications, the discrete-time
system is a single-input, single-output (SISO) system:

Discrete-time
x[n] y[n]
system
Input sequence Output sequence

8
Linear Discrete-Time Systems
◼ Definition - If y1[n] is the output due to an
input x1[ n] , and y2 [ n] is the output due to
an input x2 [ n] then, for an input:
x[n] =  x1[n] +  x2 [n]
the output is given by
y[n] =  y1[n] +  y2 [n]
◼ Above property must hold for any arbitrary
constants  and  , and for all possible
inputs x1[n] and x2 [ n] .
9
Linear Discrete-Time Systems-Cont’d
Example: the Accumulator:
Suppose input x1(n) produces output y1(n)
and x2(n) produces y2(n), where:
n n
y1[n] =  x1[], y2 [n] =  x2 []
 = −  = −
For an input:
x[n] =  x1[n] +  x2 [n]
n
the output is y[n] =  ( x1[] +  x2 [])
n n  = −
y[ n] =  x1[] +   x2 [] =  y1[ n] +  y2 [ n]
 = −  = −

Hence, the above system is linear. 10


Time -Invariant System
◼ For a time-invariant system, if y1[n] is the
response to an input x1[n] , then the
response to an input:
x[n] = x1[n − no ]
is simply:
y[n] = y1[n − no ]
where no is any positive or negative
integer.
◼ The above relation must hold for any
arbitrary input and its corresponding
output. 11
Linear Time-Invariant System
• A system satisfying both the linearity
and the time-invariance property.

• LTI systems are mathematically easy to


analyse and characterise.

12
Finite-Dimensional, Discrete-Time Linear,
Time Invariant (LTI) Systems
An important subclass of discrete-time, linear,
time- invariant (LTI) systems is characterised by a
linear constant-coefficient difference equation of
the form:
N M
 d k y[n − k ] =  pk x[n − k ] (d 0  0)
k =0 k =0
x[n] and y[n] are, respectively, the input and the
output of the system, while {d k } and{ pk } are
constants characterising the system.
13
Finite-Dimensional, Discrete-Time Linear,
Time Invariant (LTI) Systems-Cont’d
◼ The order of the system is given by max(N,M), which
is the order of the difference equation.
◼ The normalised form:
N M
y[n] +  ak y[n − k ] =  bk x[n − k ]
k =1 k =0
where ak = d k d 0 and bk = pk d 0
N M
or, equivalently, y[n] = − ak y[n − k ] +  bk x[n − k ]
k =1 k =0

◼ y[n] can be computed from above equation for all


n  n0 , knowing x[n] and the initial conditions:
y[no − 1], y[no − 2], ..., y[no − N ]
14
Solution by Recursion (n0=0)
Set n=0: y[0] = −a1 y[−1] − a2 y[−2] − ... − a N y[− N ]
+ b0 x[0] + b1 x[−1] + ... + bM x[− M ]
Set n=1: y[1] = −a1 y[0] − a2 y[−1] − ... − a N y[− N + 1]
+ b0 x[1] + b1 x[0] + ... + bM −1 x[− M + 1]
In general: y[n] = −a1 y[n − 1] − a2 y[n − 2] − ... − a N y[n − N ]
+ b0 x[n] + b1 x[n − 1] + ... + bM x[n − M ]
This process is called Nth-order recursion because N past
values of y are used. If ai are all zero, then:

y[n] = b0 x[n] + b1 x[n − 1] + ... + bM x[n − M ]


which is non-recursive. 15
Impulse Response: FIR and IIR
❑ Impulse response: the zero-state output of an LTI
system when the input is [n].
x[ n] =  [ n] LTI y[ n] = h[ n]

❑ If a discrete time LTI system has a non-recursive


difference equation (of finite order) then it has a
finite impulse response (FIR).
❑ If a discrete time LTI system has a recursive
difference equation then it has an infinite impulse
response (IIR). That means the impulse response
{h[n]} has an infinite number of non-zero values.
16
Impulse Response-Examples
Example: The impulse response of the system:
y[n] = 1x[n] +  2 x[n − 1] +  3 x[n − 2] +  4 x[n − 3]
is obtained by setting x[n] = [n] resulting in:
h[n] = 1 [n] +  2 [n − 1] +  3 [n − 2] +  4 [n − 3]

Example: Calculate the impulse response of


the following system for 0n 3:
y[n] + 0.5 y[n − 1] = x[n];
17
Impulse Response-MATLAB Calculation
The MATLAB command impz can be used to
calculate the numerical solutions of h[n].
N M
 d k y[n − k ] =  pk x[n − k ]
k =0 k =0
Define two input vectors:
d=[d0,d1,…, dN]; coefficients associated with the output.

p=[p0,p1,…, pM]; coefficients associated with the input.

Command: [h,T]=impz(p,d);
Output vectors:
h: impulse response;
T: a vector of time (or sample intervals) (T = [0 1 2 ...]').
18
Impulse Response- MATLAB Calculation
Cont’d
Example:
y[n] + y[n − 1] + 0.16 y[n − 2] = 3 x[n] + 1.2 x[n − 1];
MATLAB source code:

>> p=[3, 1.2];


>> d=[1, 1, 0.16];
>> [H,T]=impz(p,d);
>> % Plot the impulse response H;
>> stem(T,H);
>> xlabel('n');
>> ylabel('h[n]');

Type “help impz” in Matlab to learn more about this command


Type H(1:5) to get values of h[n] for n=0,1,2,3,4. 19
Impulse Response- MATLAB
Calculation-Cont’d
3

2.5

1.5

1
h(n)

0.5

-0.5

-1

-1.5

-2
0 5 10 15 20 25 30 35 40 45
n
20
A System Model

The diagram shows a sequence of delay elements which


transfer sample values from input to output on each increment
of the time index n. If we clear the memory (i.e. set all x(n-i)=0)
and input δ(n), i.e. the sequence 1,0,0,0…, the output will be the
signal h(0), h(1), h(2),…. We may therefore use this system as a
model for any LTI system whose impulse response, h(n), is known.

21
Convolution in Time
If we clear the memory again and input the sequence x[0], x[1],
x[2], etc then, when x[n] appears at the input, the state of the
system will be as in the diagram and the output will be

y[n] = h[0]x[n] + h[1]x[n − 1] + h[2]x[n − 2]


 
=  h[k ]x[n − k ] =  x[k ]h[n − k ]
k =0 k =0

Which is a convolution in time and corresponds to the


multiplication [X(ejω). H(ejω)] in frequency or Z domains (recall
that Z=ejω). 22
Convolution Using MATLAB
◼ The MATLAB command conv implements
the convolution sum of two finite-length
sequences.
◼ If a =[− 2 0 1 − 1 3]
b =[1 2 0 -1]
then conv(a,b) yields
[− 2 − 4 1 3 1 5 1 − 3]
23
Stability and Causality
◼ Bounded Input Bounded Output (BIBO) Stability
Condition - A discrete-time LTI system is BIBO stable if
and only if its impulse response sequence {h[n]} is

absolutely summable, i.e. S=  h[n]  


n = −

Causality: Any practical LTI system operating in real


time must be causal meaning that its impulse
response {h[n]} is zero for negative values of n, i.e.,

h[n] = 0; n  0
24
Normalised Digital Frequency
◼ In digital signal processing systems, a normalised
digital frequency is used in the analysis and design
rather than actual frequency (in Hz or rad/s).

◼ This is expressed as: ω = 2π f/fs, where f is the actual


frequency and fs is the sampling frequency. The unit
of ω is rad (angle).

◼ Hence, the range of ω is from 0 to 2π (or –π to π).

◼ In any digital signal processing, there is a sampling


frequency fs (even if it is not mentioned explicitly). 25
Summary
• Discrete time signals consist of sequences of
sample values {x[n]} of which basic examples are
δ[n] and u[n].

• We are concerned with the response to such


signals by LTI discrete time systems, which may be
characterised by the DE (Difference Equation)
N M
y[ n] = − ak y[ n − k ] +  bk x[n − k ]
k =1 k =0

26
Summary-Cont’d
• The response of such a system to δ[n] is the
impulse response h[n].

• The response to input x[n] is the convolution


x[n]*h[n].

• Systems may be FIR or IIR.

• We need systems which are stable:  h[n ]  


and causal (where the output depends on
past/current inputs but not future inputs):

h[n] = 0; n  0
27
Today’s Lecture Rating

28

You might also like