0% found this document useful (0 votes)
30 views44 pages

Chapter 2 Systems

Uploaded by

thasleemkamila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views44 pages

Chapter 2 Systems

Uploaded by

thasleemkamila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Discrete Time Systems

(Chapter 2)

Dr. Russell Hardie


Discrete Signals and Systems
ECE 334

1
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Systems

Figure 2.6 Representation of a discrete-time system, i.e.,


a transformation that maps an input sequence x[n] into a
unique output sequence y[n].

2
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
System Examples

◼ Delay
y[n] = x[n − n0 ]

◼ Moving Average
M −1

 x[n − k ]
1
y[n] =
M k =0

3
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Moving Average Filter
Moving window (sliding window) filter operator

M=5

x[3]

M −1

 x[n − k ]
1
y[n] =
M k =0
y[2]
4
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Moving Average Filter
Moving window (sliding window) filter operator

M=5

x[3]

M −1

 x[n − k ]
1
y[n] =
M k =0
y[3]
5
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
System Types
◼ Linear y[n] = T {ax1[n] + bx2 [n]} = aT {x1[n]} + bT {x2 [n]}
Sum of inputs produces a sum of outputs (i.e., superposition applies).
Scaled input produces a scaled output.
A weighted sum of inputs produces is a weighted sum of outputs.

xk [n] → yk [n]

x[n] =  a x [n] → y[n] =  a y [n]


k
k k
k
k k

◼ Time Invariant (vs. Time Varying)


Delayed input, produces same but delayed output.
System does not change and do different things over time.
x[n] → y[n]
x[n − n0 ] → y[n − n0 ]
6
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
System Types
◼ Causal
◼ Output does not depend on future inputs
y[n] = x[n] + x[n − 2] (causal)
y[n] = x[n] − x[n + 5] (non-causal)

◼ Bounded-input bounded-output (BIBO)


stable
If | x[n] | B1  , n
then | y[n] | B2  , n for a BIBO stable system

7
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Linear Time Invariant (LTI)
◼ For an LTI system, we can completely specify
it by its impulse response

 [n] → h[n]

 [n] 1 h[n]

0 n 0 n

8
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Linear Time Invariant (LTI)
◼ For an LTI system, we can completely specify
it by its impulse response and can compute
the output for any input using convolution
 [n] → h[n]
 [n − k ] → h[n − k ] (TI)

 a  [n − k ] →  a h[n − k ]
k
k
k
k (LTI)
 
x[n] =  x[k ] [n − k ] → y[n] =  x[k ]h[n − k ]
k =− k =−
(LTI)

Convolution
9
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Discrete Convolution
◼ Convolution operator 
y[n] = x[n]* h[n] =  x[k ]h[n − k ]
k =−
◼ Note when you do discrete convolution, you are
implementing the system!
◼ Approaches to computing y[n]
◼ I Sum of impulse responses
◼ For short finite x[n] and h[n] only

◼ II Analytic sum
◼ Use pictures and equations to get a closed form solution for any
convolution
◼ III Numerically (MATLAB)
◼ For more: see the joy of convolution
◼ http://www.jhu.edu/signals/discreteconv2/index.html

10
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
1.5
1

-1

Sum of 1 1

Impulse 1.5

Responses
1.5

Approach

-1 -1

Figure 2.8 Representation of the


output of an LTI system as the
superposition of responses to
individual samples of the input.
11
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Analytic Sum Approach

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

Given x[n] and h[n], find expression for y[n] valid for all n

1. Draw x[k] vs. k (just swap k for n)


2. Draw h[k] vs. k (just swap k for n)
3. Draw h[n-k] vs. k for some n (flip the drawing from Step 2 and put n
where 0 was on horizontal axis, then imagine moving n)
4. Determine regions of n where overlap exists/changes in k
5. Express the sum for each region of n
6. Use the summation formulas to provide closed form expression for y[n]
7. Present the results as a full piecewise function (with all n accounted for)

12
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Summation Formulae
◼ Divergent series sum
N
N ( N + 1)

k =1
k=
2
Gauss Legend


1
◼ Infinite exponential sum a =
k
, |a | 1
k =0 1− a

n2 +1

n2 n1


a a
◼ Finite exponential sum ak = , a 1
k = n1 1− a
13
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] =  n u (n)

x[n] n


0 n
h[n] n


0 n

14
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] =  n u (n)

x[k ] k


0 k
h[k ] k


0 k

15
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] =  n u (n)

x[k ] k


0 k
h[n − k ]
 n−k

0 k
n
16
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] =  n u (n)

x[k ] k


0 k
h[nh[−nhk[−n]hk[−n]hk[−]nk−] k ]
 n− kn− kn− kn− kn − k
… … … … …
0 k
n =n−=2n−=
1 n0=n1= 2
17
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] =  n u (n)
Region I
n<0 x[k ]
y[n]=0 k

0 k
h[n − k ]
 n−k

n 0 k

18
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1
For Region II only we can write
Region II n0 n
y[n] =  
 k n−k

k =0
x[k ] k

( )
n
−1
 k y[n] =  n 
… k =0

0 k
a n1 − a n2 +1
n2

h[n − k ]  k
a =
1− a
, a 1
 n−k k = n1

0
n k
y[n] =  n (
1 −  )
−1 n +1

(
1 −  −1 )
19
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 1

 0 n0

Full Solution
as a piecewise function y[n] =  n 1 −  (
−1 n +1
)
 n0
( )
(don’t forget ALL the pieces!) −1
 1 − 

20
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution Example 2

x[n] =  n u (n)
y[n] =  x[k ]h[n − k ]
k =− h[n] = u (n) − u (n − N )

1. Draw x[k] vs. k (just swap k for n)


2. Draw h[k] vs. k (just swap k for n)
3. Draw h[n-k] vs. k for some n (flip the drawing from Step 2 and put n
where 0 was on horizontal axis, then imagine moving n)
4. Determine regions of n where overlap exists/changes in k
5. Express the sum for each region of n
6. Use the summation formulas to provide closed form expression for y[n]
7. Present the results as a full piecewise function (with all n accounted for)

See Example 2.11 on Page 27.

21
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Figure 2.10 Sequence involved
in computing a discrete
convolution. (a)–(c) The
sequences x[k] and h[n− k] as a
function of k for different values
of n. (Only nonzero samples are
shown.) (d) Corresponding
output sequence as a function
of n.

22
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution in MATLAB
◼ conv( )
conv Convolution and polynomial multiplication.
C = conv(A, B) convolves vectors A and B. The resulting vector is
length MAX([LENGTH(A)+LENGTH(B)-1,LENGTH(A),LENGTH(B)]). If A and B are
vectors of polynomial coefficients, convolving them is equivalent to
multiplying the two polynomials.

C = conv(A, B, SHAPE) returns a subsection of the convolution with size


specified by SHAPE:
'full' - (default) returns the full convolution,
'same' - returns the central part of the convolution
that is the same size as A.
'valid' - returns only those parts of the convolution
that are computed without the zero-padded edges.
LENGTH(C)is MAX(LENGTH(A)-MAX(0,LENGTH(B)-1),0).

See also deconv, conv2, convn, filter and,


in the signal Processing Toolbox, xcorr, convmtx.
23
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution in MATLAB
Example 1: h = ones(1,5);
Here we have no
corresponding n
x = ones(1,9); arrays (amplitudes
y = conv(x,h); only)

figure(1)
Without an n array,
stem(x)
MATLAB plots vs.
title('x[n]')
element number
starting with 1 (not
figure(2)
necessarily the
stem(h)
desired n)
title('h[n]')

figure(3)
stem(y)
title('y[n]')

24
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution in MATLAB
◼ Full convolution output length is:
length(x) + length(h) – 1
◼ conv( ) command does not track where on the n
axis any of the signals lie (amplitudes only)
◼ You need to keep track of the independent variable, n,
for your x, h, and y arrays
◼ The first n value of the y array is the sum of the first n

value of the x and h arrays:


n y1 = nx1 + nh1

25
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Convolution in MATLAB
Example 2: h=ones(1,3);
nh = [-1:1];
In general, the first n
value of the y array is the
x = ones(1,5); sum of the first n value of
nx = [4:8]; the x array and the first n
y = conv(x,h); value of the h array
ny1 = nx(1) + nh(1)
ny = [ ny1 : ny1 + length(y)-1 ];

figure(1)
stem(nx,x)
xlabel('n')
ylabel('x[n]')
title('Signal')

figure(2)
stem(nh,h)
xlabel('n')
ylabel('h[n]')
title('Impulse Response')

figure(3)
stem(ny,y)
xlabel('n')
ylabel('y[n]')
title('Output')

Chapter 2/run_conv_examples.m 26
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Anything convolved with a delta…

◼ Convolution y[n] = x[n]* h[n] =  x[k ]h[n − k ]
k =−
◼ Anything convolved with a delta is itself

y[n] = x[n]*  [n] =  x[k ] [n − k ] = x[n]
k =−
◼ Anything convolved with a delta shifted it itself shifted

y[n] = x[n]*  [n − n0 ] =  x[k ] [n − k − n ] = x[n − n ]
k =−
0 0

◼ Anything convolved with a delta shifted and scaled it itself shifted


and scaled

y[n] = x[n]* a [n − n0 ] =  x[k ]a [n − k − n ] = ax[n − n ]
k =−
0 0
27
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Properties of LTI Systems
◼ Commutative
x[n] y[n]
h[n]

y[n] = x[n]* h[n] =  x[k ]h[n − k ]
k =−

h[n] y[n]
x[n]

y[n] = h[n]* x[n] =  h[k ]x[n − k ]
k =−
28
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Properties of LTI Systems
x[n]* h1[n]
◼ Associative

y[n] = x[n]* h1[n]* h2 [n]


= ( x[n]* h1[n]) * h2 [n]
= ( x[n]* h2 [n]) * h1[n]
= x[n]* ( h1[n]* h2 [n])

Associative Property

29
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Properties of LTI Systems
◼ Distributive x[n]* h1[n]

x[n]* h2 [n]
y[n] = ( x[n]* h1[n]) + ( x[n]* h2 [n])
= x[n]* ( h1[n] + h2 [n])
Distributive Property

30
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Inverse System
x[n] y[n]
h1[n] h2[n]

y[n] = x[n]* ( h1[n]* h2 [n])


h1[n]* h2 [n] =  [n]
y[n] = x[n]*  [n] = x[n]

First system is usually something we can’t control (like the degradation in a


communications channel). The second system we typically design to “undo” the
impact of the first system. Not all systems have a true inverse!!! (a moving
average filter for example does NOT). However, later we shall see how we can
approximate an inverse in these cases.

31
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
BIBO Stable
◼ LTI is BIBO stable if impulse
response is absolutely summable

y[n] = x[n]* h[n] =  x[k ]h[n − k ]
k =− BIBO Stable?

| y[n] |=| x[n]* h[n] |  | x[k ] || h[n − k ] |
k =−
h[n] = .5n u ( n)
 h[n] = .5n u ( −n)
| y[n] | B x | h[n − k ] |
k =− h[n] = 2n u (n)
BIBO Stable if
h[n] = u (n)
 

 | h[n − k ] | ,  | h[k ] | 
k =− k =−
h[n] = cos( n)
32
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Causality This one responds at the impulse
(NOT before) - Causal

 [n] h[n]

0 n 0 n

This one responds BEFORE the


input - Noncausal

h[n]
 [n]
0 n 0 n

h[n] = 0, n  0 for causality


33
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LTI System Example 1
y[n] = x[n − 5] •BIBO Stable because h[n] is absolutely
summable
•Causal because h[n] does NOT start
before n=0
Let: x[n] =  [n] •Inverse ?

Define: y[n] = h[n]


h[n] =  [n − 5]
h[n] =  [n − 5]
hI [n] =  [n + 5]
h[n]

1 …
h[n]* hI [n] =  [n]

34
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LTI System Example 2
1 4
y[n] = 
5 k =0
x[n − k ] •BIBO Stable because h[n] is absolutely
summable
•Causal because h[n] does NOT start
before n=0
•Inverse ?
1 4
h[n] = 
5 k =0
 [n − k ]
h[n]* hI [n] =  [n]
hI [n] = ????
h[n]
1/5 …

35
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LTI System Example 3
•BIBO Stable because h[n] is absolutely
summable
h[n] = .5n u[n]  

 | h[n] |  
1
ak = , |a | 1
n =− k =0 1− a


1
| .5 |=
n
=2
n =0 1 − .5
1
h[n] 1/2 •Causal because h[n] does NOT start
1/4 before n=0
1/8 •Inverse ?
1/16 …

0 n h[n]* hI [n] =  [n]


hI [n] = ????
36
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Nonlinear System Example
y[n] = median x[n], x[n − 1], x[n − 2]

x[n] =  [n] h[n]

x[n] = u[n] y[n]

What would convolution predict?


37
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Nonlinear Systems
◼ Impulse response can be found, but is
essentially useless (superposition does NOT
apply)
◼ Convolution does NOT apply
◼ Later we shall see that frequency response
effectively does NOT apply
◼ Make sure your system is LTI before using
convolution, or using the impulse response
to determine any system properties!
38
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LCCDE
◼ Linear constant coefficient difference
equation (LCCDE) for LTI systems
◼ We know that h[n] is a complete description
of an LTI system and we can use it for
convolution (to compute system output) and
determining the system properties
◼ Another equivalent and complete description
of an LTI system is its LCCDE

39
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LCCDE
N M

 a y[n − k ] =  b
k =0
k
m =0
m x[ n − m]

a0 y[n] + a1 y[n − 1] + ... + aN y[n − N ] =


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

◼ In principle, this describes all LTI systems


◼ Some LTI systems would require an infinite M or N
(like an ideal filter)
◼ Can be causal, noncausal, stable, or unstable
◼ Can be finite impulse response (FIR) or infinite
impulse response (IIR)
40
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LCCDE Example 1
1 1
◼ MA Filter y[n] = x[n] + x[n − 1]
2 2
a0 = 1
b0 = 1 / 2
b1 = 1 / 2 Finite Impulse
Response
(FIR)

x[n] =  [n], y[n] = h[n] h[n] 1/2


1 1
h[n] =  [n] +  [n − 1]
2 2
41
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
LCCDE Example 2
◼ Accumulator y[n] = y[n − 1] + x[n]
a0 = 1
a1 = −1
b0 = 1 Infinite
Impulse
Response (IIR)

h[n] = h[n − 1] +  [n]


h[n] 1
h[n] = u[n] …

42
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
FIR or IIR?
◼ How to know if an LCCDE corresponds
to an FIR or IIR?
◼ Easy, look for recursion. Any recursive
LCCDE corresponds to an IIR.
◼ Recursion means the output now depends
on the output at some other time and
possibly the input as well.

y[n] = .5 y[n − 1] + x[n] + .7 x[n − 2]


Recursive Delay, no
term recursion
43
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.
Given This
System Type h[n] LCCDE H(w) General
Linear No way to know ALL LCCDE’s No way to know Weighted sum of inputs
for sure (but it are LTI for sure (but it produces a weighted
usually assumed) usually assumed) sum of outputs
(superposition)
Time invariant No way to know ALL LCCDE’s No way to know Delayed input produces
for sure (but it are LTI for sure (but it a delayed output
usually assumed) usually assumed)
Infinite impulse h[n] has infinite IIR will have Not easy to Find impulse response
response (IIR) duration (some recursive terms determine and see if it has infinite
(vs. FIR) non-zero values like y[n-1] (causal IIRs cannot duration
present out to n = have exactly linear
infinity) phase)
Causal h[n] does not start No future terms Not easy to Current output never
before n=0 like x[n+1] or determine depends on future
y[n+1] inputs or outputs
BIBO stable h[n] is absolutely Not easy to |H(w)| < infinity Bounded input (|x[n]|
summable (sum determine for all w <infinity) always
of absolute values produces a bounded
< infinity) output
44
COPYRIGHT © R. C. HARDIE. ALL RIGHTS RESERVED.

You might also like