Post on 13-Apr-2018
7/27/2019 Lecture 03 - Discrete-time Systems
1/30
Discrete-time Systems
Lecture 3
7/27/2019 Lecture 03 - Discrete-time Systems
2/30
Discrete Systems
Mathematically described as T[.] that take
sequence x(n) and transform to anothersequence y[n]
)]([)( nxTny =
7/27/2019 Lecture 03 - Discrete-time Systems
3/30
Linear System
A system is linear if and only if
)]([)]([)]()([ 22112211 nxLanxLanxanxaL +=+
)(),(,,2121
nxnxaa
7/27/2019 Lecture 03 - Discrete-time Systems
4/30
Linear System
Output of linear system to an arbitrary input x(n)
L[(n-k)] = h(n,k) is the response of linear system at time n toa unit sample at time k
Called impulse response
This is a time-varying impulse response h(n,k) which is notvery convenient
=
=
=
==nn
knLkxknkxLnxLny )]([)()()()]([)(
=
=n
knhkxny )()()(
7/27/2019 Lecture 03 - Discrete-time Systems
5/30
Linear time-invariant (LTI) System
A linear system in which an input-output pair x(n) and y(n) is
invarient to a shift kin time
The L[.] and shifting operators are reversable
)()]([)]([)( knyknxLnxLny ==
L[.] Shift by k
Shift by k L[.]
x(n) y(n)
x(n) y(n-k)
y(n-k)
x(n-k)
7/27/2019 Lecture 03 - Discrete-time Systems
6/30
Linear time-invariant (LTI) System
Time-invariant function: h(n-k)
Output form:
Impulse response of an LTI system is given by h(n)
the operation is called linear convolution sum *
=
==n
knhkxnxLTIny )()()]([)(
h(n)x(n) y(n) = x(n) * h(n)
===
n
knhkxnhnxny )()()(*)()(
7/27/2019 Lecture 03 - Discrete-time Systems
7/30
Stability
Important to consider stability to avoid building harmful
systems or avoid burnout or saturation in system operation
A system is boundary-input boundary-output (BIBO) stable if
every bounded input produces a bounded output
An LTI system is BIBO if and only if its impulse response is
absolutely sumable
yxnynx ,,)()(
7/27/2019 Lecture 03 - Discrete-time Systems
8/30
Causality
Necessary to make sure the system can be built
A system is causal if the output at index n0 depends only on
the input up to and including index n0 (output does not depend
on future value)
An LTI system is causal if and only if
0,0)(
7/27/2019 Lecture 03 - Discrete-time Systems
9/30
Example of Convolution
let the rectangle pulse x(n)=u(n)-u(n-10) be an input to an LTI systemwith impulse response
Determine the output y(n)
Almost geometric series sum except that the term u(n-k) takes differentvalues depending on n and k
)()9.0()( nunh n=
==
==9
0
9
0
)()9.0()9.0()()9.0)(1()(k
k
k
nkn knuknuny
7/27/2019 Lecture 03 - Discrete-time Systems
10/30
Example of Convolution
When n
7/27/2019 Lecture 03 - Discrete-time Systems
11/30
Example of Convolution
Given the following two sequence
Determine the convolution y(n) = x(n)*h(n)
33],2,4,1,0,7,11,3[)( = nnx 41],1,2,5,0,3,2[)( = nnh
]2,8,3,22,18,41,5,51,6,47,31,6[)( =ny
011)5(3)1()( +=k
khkx
2037 ++
)1(6 == y
27111)2()( +=k
khkx
0)1()5(0 ++2234 ++
)2(41 y==
7/27/2019 Lecture 03 - Discrete-time Systems
12/30
MATLAB Implementation
>> x=[ 3, 11, 7, 0, - 1, 4, 2] ;
>> h=[ 2, 3, 0, - 5, 2, 1] ;
>> y = conv( x, h)
y =
6 31 47 6 - 51 - 5 41 18 - 22 - 3 8 2
>>
conv function computes convolution between two finiteduration sequences, assuming the two sequences begin atn=0
7/27/2019 Lecture 03 - Discrete-time Systems
13/30
MATLAB Implementation
f unct i on [ y, ny] = conv_m( x, nx, h, nh)
nyb = nx( 1) +nh( 1) ;nye = nx( l engt h( nx) ) + nh( l engt h( nh) ) ;ny = [ nyb: nye] ;
y = conv( x, h) ;
Given a finite duration x(n) and h(n),
The beginning and ending points of y(n) are
>> [ y, ny] =conv_m( x, nx, h, nh)
y =
6 31 47 6 - 51 - 5 41 18 - 22 - 3 8 2
ny =- 4 - 3 - 2 - 1 0 1 2 3 4 5 6 7
});({ xexb nnnnx });({ hehb nnnnh and
hbxbyb nnn += hexeye nnn +=and
7/27/2019 Lecture 03 - Discrete-time Systems
14/30
Sequence Correlation Revisited
The cross correlation can be put in the form
With autocorrelation in the form
)(*)()( lxlylryx =
)(*)()( lxlxlrxx =
7/27/2019 Lecture 03 - Discrete-time Systems
15/30
example of the crosscorrelation sequence
Let this be a prototype sequence
Let y be its noise-corrupted-and-shifted version
Where w(n) is a Gaussian sequence with mean 0 and variance 1
Compute crosscorrelation between y(n) and x(n)
]2,4,1,0,7,11,3[)( =
nx
)()2()( nwnxny +=
7/27/2019 Lecture 03 - Discrete-time Systems
16/30
Example of the crosscorrelation sequence>> x = [ 3 11 7 0 - 1 4 2] ;>> nx = [ - 3: 3] ;>> [ y, ny] = si gshi f t ( x, nx, 2) ;>> w=r and( 1, l ength( y) ) ; nw=ny;>> [ y, ny] =si gadd( y, ny, w, nw) ;>> [ x, nx] =si gf ol d( x, nx) ;
>> [ r xy, nr xy] =conv_m( y, ny, x, nx) ;>> subpl ot ( 1, 1, 1) , subpl ot ( 2, 1, 1) ; st em( nr xy, r xy) ;>> axi s( [ - 5, 10, - 50, 250] ) ; xl abel ( ' l ag var i abl e l ' ) ;>> yl abel ( ' r xy' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
17/30
Example of the crosscorrelation sequence>> x = [ 3 11 7 0 - 1 4 2] ;>> nx = [ - 3: 3] ;>> [ y, ny] = si gshi f t ( x, nx, 2) ;>> [ r xy, nr xy] =xcor r ( x, y) ;>> subpl ot ( 1, 1, 1) , subpl ot ( 2, 1, 1) ; st em( nr xy, r xy) ;>> axi s( [ - 5, 10, - 50, 250] ) ; xl abel ( ' l ag var i abl e l ' ) ;
>> yl abel ( ' r xy' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
18/30
crosscorrelation and autocorrelation>> x = [ 3 11 7 0 - 1 4 2] ;>> nx = [ - 3: 3] ;>> [ y, ny] = si gshi f t ( x, nx, 2) ;>> [ r xy, nr xy] =xcor r ( x, y) ;>> st em( nr xy, r xy) ; axi s( [ - 5, 10, - 50, 250] ) ; xl abel ( ' l ag var i abl e l ' ) ; yl abel ( ' r xy' ) ;>> [ r xx, nr xx] =xcor r ( x) ;
>> st em( nr xx, r xx) ; axi s( [ - 5, 10, - 50, 250] ) ; xl abel ( ' l ag var i abl e l ' ) ; yl abel ( ' r xx' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
19/30
Different Equations
An LTI discrete system can also be described by a linear
constant coefficient different equation of the form
If aN 0, then the equation is of order N
Another form is
nmnxbknyaN
k
M
m
mk = =
=0 0
),()(
== =N
k
k
M
m
m knyamnxbny00
)()()(
7/27/2019 Lecture 03 - Discrete-time Systems
20/30
Different Equations
The solution of this equation can be obtained in the form
The homogenous part of the solution, yH(n) is given by
Where zk, k=1..N are N roots (called natural frequencies) ofthe characteristic equation
)()()( nynyny PH +=
=
=N
k
n
kkH zcny0
)(
=
=N
k
k
kza0
0
7/27/2019 Lecture 03 - Discrete-time Systems
21/30
Different Equations
The system is stable if the roots zk satisfy the condition
Then the causal system is stable
Where zk, k=1..N are N roots (called natural frequencies) of
the particular part yP(n) is determined from
Nkzk ,...,1,1 => b=[ 1] ; a=[ 1, - 1, 0. 9] ; n=[ - 20: 120] ;>> h=i mpz( b, a, n) ;>> xl abel ( ' n' ) ; yl abel ( ' h( n) ' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
24/30
Example
Given a difference equation
Calculate and plot the unit step response s(n) at n = -20,,120nnxnynyny
=+ );()2(9.0)1()(
>> b=[ 1] ; a=[ 1, - 1, 0. 9] ; n=[ - 20: 120] ;
>> x=st epseq( 0, - 20, 120) ; s= f i l t er ( b, a, x) ;>> st em( n, s) ;>> xl abel ( ' n' ) ; yl abel ( ' s(n) ' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
25/30
Example
Given a difference equation
Is the system specified by h(n) stable?
We can use the plot of the impulse response to observe that h(n) ispractically zero for n > 120. We can check if
Therefore, the system is stable
nnxnynyny =+
);()2(9.0)1()(
>> sum( abs( h) )ans =
14. 8785
>> z = r oot s( a) ; magz = abs( z)magz =0. 94870. 9487
The sum is less than infinityThe roots are less than one
7/27/2019 Lecture 03 - Discrete-time Systems
26/30
Example (cont.)
By definition h(n) is the output of an LTI system when the
input is (n)
Substituting x(n) for (n) and y(n) for h(n), the difference eq. is
)()1(9.0)( nxnyny =
>> a=[ 1, - 1, 0. 9] ; b=1;>> x=i mpseq( 0, - 20, 120) ; n=[ - 20: 120] ;>> h=f i l t er ( b, a, x) ;>> st em( n, h) ;>> axi s( [ - 20, 120, - 1. 1, 1. 1] )
>> t i t l e( ' I mpul se Response' ) ;>>xl abel ( ' n' ) ; yl abel ( ' h( n) ' ) ;
7/27/2019 Lecture 03 - Discrete-time Systems
27/30
Zero-Input and Zero State Response Difference eq. is solved forward in time from n=0
Initial condition on x(n) and y(n) are necessary to determine the output for
n >=0. The initial condition is given by
Subject to the initial conditions:
A solution can be obtained in the form
yZI(n) is called zero-input solution: due to the initial conditions alone(assuming they exist)
yZS(n) is called zero state solution: due to input x(n) alone(assuming the initial conditions are zero)
0;)()()(00
= ==
nknyamnxbnyN
k
k
M
m
m
}1);({ nNny }1);({ nMnx
)()()( nynyny ZSZI +=
7/27/2019 Lecture 03 - Discrete-time Systems
28/30
Digital Filters
Filter means LTI system designed for a
specific job of frequency selection or
discrimination
7/27/2019 Lecture 03 - Discrete-time Systems
29/30
FIR (Finite-duration Impulse Response) Filters
the unit impulse response of the LTI system is of finite duration
h(n) = 0 for n < n1 and n > n2
Causal FIR filter:
h(0) = b0, h(1) = b1, h(2) = b2 h(M) = bM. Other h(n) are 0
Also called nonrecursive or moving average (MA) filter.
Represented as impulse response {h(n)} or as difference eq. coefficient
{bm} and {a0 = 1}
We can use either conv(x,h) or filter(b,1,x)
Output of conv(x,h) has longer length than both x(n) and h(n)
Output of filter(b,1,x) has same length as x(n)
=
=M
m
m mnxbny0
)()(
7/27/2019 Lecture 03 - Discrete-time Systems
30/30
IIR (Infinite-duration Impulse Response) Filters
the impulse response of the LTI system is of infinite duration
The part of difference eq:
output y(n) is recursively computed from previously computed values
Also called autoregressive (AR) filter.
This is also decribes IIR filter
called autoregressive moving average (ARMA) filter
Described by difference eq. coefficients {bm} and {ak}, implemented byfilter(b,a,x)
)()(0
nxknyaN
k
k ==
nmnxbknya
N
k
M
mmk
= = =0 0 ),()(