(n)+

DIGITAL SIGNAL
PROCESSING
Vedat Tavşanoğlu
Response of LTI Systems
The linear operation T[ . ] on a function x(n), i.e.T[x(n)] is
defined as in the following :
(a) T[(n)] = h(n) where (n) is the unit-impulse function;
(b) If T[x1(n)] = y1(n)
and
T[x1(n)] = y1(n)
then
T[a1 x1(n)+a2 x2(n)] = a1 y1(n)+a2 y2(n) (linearity)
Now define the time-invariant (shift-invariant) operation T[.]:
(c) If T[x(n)]=y(n) then T[x(n-k)]=y(n-k) (time-invariance).
19 April 2010
DIGITAL SIGNAL PROCESSING
2
Response of LTI Systems
Since any signal x(n) can be expressed in terms of
the unit sample (n) as
x ( n) 

 x(k ) (n  k )
k  
The following are true for an LTI system:
19 April 2010
DIGITAL SIGNAL PROCESSING
3
Response of LTI Systems
 (n)
 (n  k )
19 April 2010
T[.]
T[.]
h(n)  T [ (n)]
h(n  k )  T [ (n  k )]
DIGITAL SIGNAL PROCESSING
Time invariance
4
Response of LTI Systems
T [ x(k ) (n  k )]  x(k )T [ (n  k )]
x(k ) (n  k )
Linearity (scaling)
T[.]
 x ( k ) h( n  k )
Time invariance

T [  x(k ) (n  k )] 

 x(k ) (n  k )
k  
T[.]
k  

 T [ x(k ) (n  k )]
k  
Linearity (additivity)

 x(k )T [ (n  k )]
k  
Linearity (scaling)


 x ( k ) h( n  k )
k  
19 April 2010
DIGITAL SIGNAL PROCESSING
Time invariance
5
Response of LTI Systems
This expression is called the Convolution Sum. With a simple
change of variable we obtain the following:


k  
k  
y( n ) 
 x( k )h( n  k )   x( n  k )h( k )
Given an input x(n) and h(n), the response of the system
to an impulse (n), the above expression tells us how to
evaluate the output y(n). If x(n) and h(n) are of finite
duration then:
length of y(n)= length of x(n)+ length of h(n)-1
19 April 2010
DIGITAL SIGNAL PROCESSING
6
Response of LTI Systems
In the case where
x(n)  h(n)  0 for n  0
the lower and upper limits for summation are, respectively, k=0
and n. This can be shown as follows:
Since x(n)=h(n)=0 for n<0 it is evident from the convolution
sum formula that k must satisfy the following:
k 0,nk 0
which yields
k 0,k n
0k n
hence the following:
19 April 2010
DIGITAL SIGNAL PROCESSING
7
Response of LTI Systems
n
n
k 0
k 0
y ( n)   x ( k ) h( n  k )   x ( n  k ) h( k )
We can state the following:
The smallest value of the lower limit in the first expression
is zero and the geatest value of the upper limit in the second
expression is n because:
x ( n)  0
for
n0
The geatest value of the upper limit in the first expression is
n and the smallest value of the lower limit in the second
expression is zero because
h( n)  0
19 April 2010
for
DIGITAL SIGNAL PROCESSING
n0
8
Response of LTI Systems

Example:
x(n)
1
Find the output y(n) for the system given below.
1
 
-1
0
1
2
n
h(n)

-2 -1
19 April 2010

1

1/2
1/4
0
1
2

DIGITAL SIGNAL PROCESSING
0
3
4
y(n)
n
5
9
Response of LTI Systems
Length of x(n)=2, length of h(n)=3 therefore length of y(n)=2+3-1=4
Using the first expression of the convolution sum we should work out the
following four values :
0
y (0)   x(k )h(0  k )  x(0)h(0)  1x1  1
k 0
1
1
1
y (1)   x(k )h(1  k )  x(0)h(1)  x(1)h(0)  1x  1x1  1
2
2
k 0
1
1
y (2)   x(k )h(2  k )  x(0)h(2)  x(1)h(1)  1x1 / 4  1x1  1
4
k 0
1
1 1
y (3)   x(k )h(3  k )  x(1)h(2)  1x 
4 4
k 1
19 April 2010
DIGITAL SIGNAL PROCESSING
10
Response of LTI Systems

 

 
x(k)
1
1
k
-1
h(k)
0
1
1
2
1/2
1/4
0
-2 -1
19 April 2010
0
1
2
3
4
k
5
DIGITAL SIGNAL PROCESSING
11

Response of LTI Systems
x(k)
1
 


 

h(-k)
0

1
1
2
y(0)=1
k
 

1/2

0
1
2
n
1/4
0
-2 -1
19 April 2010
0
1
2
k
3
4
5
DIGITAL SIGNAL PROCESSING
12

Response of LTI Systems
x(k)
1
 


 

0
h(1-k)

1
1
2
y(1)=1.5
k

1/2

 
0
1
2
n
1/4
0
-2 -1
19 April 2010
0

2
k
3
4
5
DIGITAL SIGNAL PROCESSING
13

Response of LTI Systems
x(k)
1
1
 


 

0
1
h(2-k)

y(2)=0.75
k
2

1/2

 
0
1
2
3
n
1/4
0
-2
-1
0
19 April 2010

2
3
k
4
5
DIGITAL SIGNAL PROCESSING
14

Response of LTI Systems
x(k)
1
1
 



 

0
1
2
h(3-k)
k

 
y(3)=0.25

1/2

0
1
2
n
3
1/4
-1
0
19 April 2010

2
3
k
4
DIGITAL SIGNAL PROCESSING
15

Response of LTI Systems
x(k)
1
1
 



 

0
1
k
2

h(4-k)
  
y(4)=0
1/2

0
1
2
3
n
4
1/4
-1
0
19 April 2010

2
3
k
4
DIGITAL SIGNAL PROCESSING
16
Response of LTI Systems
y (n)   (n)  1.5 (n  1)  0.75 (n  2)  0.25 (n  3)

 
1.5
y(n)
1

-2 -1
19 April 2010
3/4

1/4
0
1
2
3
4
n
5
DIGITAL SIGNAL PROCESSING
17
Response of LTI Systems
MATLAB program and plots of x(n),h(n) and y(n)
close all
x=[1 1 0 0 0];
h=[1 1/2 1/4 0 0];
y=conv(x,h);
stem(x);
title('x(n)');
figure,stem(h);
title('h(n)');
figure,stem(y(1:5));
title('y(n)');
19 April 2010
DIGITAL SIGNAL PROCESSING
18
Frequency Response of LTI
Systems
In the following we will find the response of an LTI
system to the sinusoidal input signal
x(n)  A cos( 0 n   )
x(n)  A cos( 0 n   )
19 April 2010
h(n)
DIGITAL SIGNAL PROCESSING
y(n)
19
Frequency Response of LTI
Systems
x(n) can be written as:
A j ( 0 n  ) A  j ( 0 n  )
x ( n)  e
 e
2
2
A j j0n
A  j  j0n
 ( e )e
 ( e )e
2
2
19 April 2010
DIGITAL SIGNAL PROCESSING
20
Frequency Response of LTI
Systems
x(n)  e
j0n
*  j0n
 e
where * is complex-congugate of . We can further write
x(n)  x1 (n)   x2 (n)
*
Now let us first compute the response to x1(n).
Using the convolution sum,we can write:
19 April 2010
DIGITAL SIGNAL PROCESSING
21
Frequency Response of LTI
Systems
y1 (n) 


 x ( n  k ) h( k )   h( k ) e
k  

1
 [  h( k ) e
j ( n  k )
k  
 j k
]e
j n
k  
Now defining
j
H (e ) 

 h( k ) e
 j k
k  
19 April 2010
DIGITAL SIGNAL PROCESSING
22
Frequency Response of LTI
Systems
which is the Fourier transform of the system impulse
response h(n), yields
j
y1 (n)  H (e ) e
jn
It is evident from above that the response y2(n) to the
input x2(n) can be obtained by replacing  by -:
y 2 ( n )  H (e
19 April 2010
 j
)e
DIGITAL SIGNAL PROCESSING
 jn
23
Frequency Response of LTI
Systems
On the other hand since h(k) are real-valued we can write:
H (e
 j

 h( k ) e
)
jk
j
 H (e )
*
k  
where ( )* denotes complex-congugate.
Now express H(ej) in the polar form:
j
j
H (e ) | H (e ) | e
19 April 2010
DIGITAL SIGNAL PROCESSING
j  ( )
24
Frequency Response of LTI
Systems
Also considering that:
| H (e
 j
j
) || H (e ) |
 ( )   ( )
we obtain
j
j (n  ( ))
j
 j (n  ( ))
y1 (n) | H (e ) | e
y2 (n) | H (e ) | e
19 April 2010
DIGITAL SIGNAL PROCESSING
25
Frequency Response of LTI
Systems
Since the system is linear the response to
x(n)  x1 (n)   x2 (n)
*
is given as:
y (n)  y1 (n)   y2 (n)
*
A
j
j j (n  ( ))
 j  j (n  ( ))
y ( n )  | H (e ) | [e e
e e
]
2
19 April 2010
DIGITAL SIGNAL PROCESSING
26
Frequency Response of LTI
Systems
j
y (n)  A | H (e ) |[cos(n     ( ))]
Example: An LTI system is given by the impulse response
h(n)  {0.5, 1, 0.5}
The input to this system is given by:

2
x(n)  cos( n)  cos( n  )  cos( n  )  cos( n)
6
3
6
2
3
3
19 April 2010


DIGITAL SIGNAL PROCESSING


27
Frequency Response of LTI
Systems
close all
close all
n=0:1:24
x1=cos((pi/6)*n);
x2=cos((pi/3)*n-(pi/6));
x3=cos((pi/2)*n);
x4=cos((2*pi/3)*n+(pi/6));
x=x1+x2+x3+x4;
stem(x(1:25));
h=[1/2 1 1/2];
y1=conv(x1,h);
figure,stem(y1(1:25));
y2=conv(x2,h);
figure,stem(y2(1:25));
19 April 2010
y3=conv(x3,h);
figure,stem(y3(1:25));
y4=conv(x4,h);
figure,stem(y4(1:25));
y=conv(x,h);
figure,stem(y(1:25));
fx=fft(x,101);
fy=fft(y,101);
fx=abs(fx);
fy=abs(fy);
f=0:.02*pi:2*pi;
figure,plot(f,fx);
figure,plot(f,fy);
DIGITAL SIGNAL PROCESSING
28
Difference Equations
Consider the following digital filter which is a realization
of the difference equation:
y (n)  ay (n  1)  bx(n)
x(n)
The hardware implementation
of this equation will contain
two registers,namely Ry and Ra
to store the past output y(n-1)
and the multiplier coefficient a,
respectively.
b
T
+
y(n)
a
19 April 2010
DIGITAL SIGNAL PROCESSING
29
Difference Equations
MATLAB program implementing the above difference
equation and the plot of output y(n) for x(n)=0.
close all
y=1
y1=0
a=.5
x=0
for k = 1:10
y=a*y+x
x1(k)=x;
y1(k)=y;
end
figure,stem(y1),
title('y(n)')
19 April 2010
DIGITAL SIGNAL PROCESSING
30
Difference Equations
MATLAB program and the plot of output y(n) for x(n)=u(n).
close all
y=0
y1=0
a=.5
x=1
for k = 1:10
y=a*y+x
x1(k)=x;
y1(k)=y;
end
figure,stem(x1),title('x(n)')
figure,stem(y1),title('y(n)')
19 April 2010
DIGITAL SIGNAL PROCESSING
31
Difference Equations
MATLAB program and the plot of output y(n)
for x(n)= cos((pi/6)*n)
y=0
a=.5
for k = 1:24
x=cos((pi/6)*k);
y=a*y+x;
y1(k)=y;
end
figure,stem(y1),title('y(n)')
19 April 2010
DIGITAL SIGNAL PROCESSING
32
Difference Equations
Example: Suppose a person opens a morgage account
with an annual interest rate of 0.04% and borrows
$100,000 to be paid back in monthly instalments in a
period of 25 years.
(a)Find the necessary amount for monthly morgage
payments.
(a)Write down the difference equation for the remaining
morgage amount.
(a) For the monthly morgage payments x we can write:
(1  x)12  1  0.04
x  (1  .04)
1 / 12
19 April 2010
 1  0.00327374
DIGITAL SIGNAL PROCESSING
33
Difference Equations
MATLAB program for the remaining morgage
clear all
in(1)=100000;
i=1;
x=523.896;
y(1)=100000;
while i<320
in(i+1)=x;
y(i+1)=1.00327374*y(i)-in(i+1);
i=i+1;
%pause
end
stem(y)
19 April 2010
DIGITAL SIGNAL PROCESSING
34
Difference Equations
x(n)
T
a2
b0
b1
b2
T
+
y(n)
a1
y (n)  b0 x(n)  b1 x(n  1)  b2 x(n  2)  a1 y (n  1)  a2 y (n  2)
19 April 2010
DIGITAL SIGNAL PROCESSING
35
Difference Equations
The general form for an Mth-order linear constant-coefficient
difference equation can be given as follows:
N
M
i 0
i 0
y (n)   bi x(n  1)  ai y (n  1)
Case 1: ai=0, the system is called NONRECURSIVE or FINITE IMPULSE
RESPONSE (FIR) or FEEDFORWARD SYSTEM.
Case 2: ai=0 for at least one value of i, the system is called RECURSIVE or
INFINITE IMPULSE RESPONSE (IIR) or FEEDBACK SYSTEM.
19 April 2010
DIGITAL SIGNAL PROCESSING
36
Digital Filters
close all
%Plotting of continuous-time (CT) signals
t=0:1/50:1;
xa=(exp).^t+cos(2*pi*6*t);
plot(t(1:51),xa(1:51));
title(‘xa(t)=(exp).^t+cos(2*pi*6*t)');
xa1=(exp).^t;
figure,plot(t(1:51),xa1(1:51));
title(‘xa1(t)=(exp).^t)');
xa2=cos(2*pi*6*t);
figure,plot(t(1:51),xa2(1:51));
title(‘xa2(t)=cos(2*pi*6*t)');
%Sampling of CT and plotting of discrete-time signals
t=0:1/50:1;
figure,stem(x);
title(‘x(n)=(1.02)^n+cos(2pi/8)n)');
figure,stem(x1);
title(‘x1(n)=(1.02)^n)');
figure,stem(x2);
title(‘x2(n)=cos(2pi/8)n)');
19 April 2010
DIGITAL SIGNAL PROCESSING
37
Digital Filters
%Running Average Filter Impulse Response h(n)
h=(1/7)*[1 1 1 1 1 1 1];
%Plotting of h(n)
figure,stem(h)
title('h(n)=(u(n)-u(n-8))');
%Application of h(n) to the input x(n),namely conv of h(n) with x(n)
y=conv(h,x);
%Plotting of the output y(n)
figure,stem(y);
title('y(n)');
%Fourier Transforms of x(n),h(n) and y(n)
fx=fft(x,201);
fx=abs(fx);
fh=fft(h,201);
fh=abs(fh);
fy=fft(y,201);
fy=abs(fy);
19 April 2010
DIGITAL SIGNAL PROCESSING
38
Digital Filters
%Plotting of the Magnitudes of Fourier Transforms
f=0:pi/100:2*pi;
figure,plot(f,fx);
title('Fourier Transform of the Input x(n), the Frequency Spectrum of the
Input Signal');
figure,plot(f,fh);
title('Fourier Transform of h(n), the Frequency response of Filter');
figure,plot(f,fy);
title('Fourier Transform of the Output y(n),the Frequency Spectrum of the
Output Signal');
19 April 2010
DIGITAL SIGNAL PROCESSING
39
Digital Filters
19 April 2010
DIGITAL SIGNAL PROCESSING
40
Digital Filters
19 April 2010
DIGITAL SIGNAL PROCESSING
41
Digital Filters
19 April 2010
DIGITAL SIGNAL PROCESSING
42
Digital Filters
19 April 2010
DIGITAL SIGNAL PROCESSING
43