Digital Signal Processing  EECC 451
Solutions  Homework # 6
Problem 1:
A DSP system consists of three FIR filters
F
1
,
F
2
and
F
3
.
F
1
and
F
2
are connected in
parallel and
F
3
is in series with the parallel connection. The difference equations for each filter are
F
1
:
y
[
n
] =
1
2
x
[
n
] +
x
[
n

2]
F
2
:
y
[
n
] =
1
2
x
[
n
]

2
x
[
n

1]
F
3
:
y
[
n
] = 2
x
[
n
] + 3
x
[
n

1]
a) Find the
impulse response
of the overall system (e.g., the equivalent impulse response of the
filter interconnection).
b) Using Matlab (Octave) and the function
filter
find the response of the system to the in
put
x
[
n
] =
u
[
n
]

u
[
n

10]
.
Then plot (using
stem
) in the same figure the input signal
(in one color) and the output signal in another color, for example use the sequence of com
mand
stem(x,’b’);hold on;step(y,’r’);hold off
. Show the commands used
to generate the plot and include a hard copy the plot with your report.
c) Find the frequency response of the overall system.
d) Use Matlab (Octave) to obtain a plot the frequency response of the system. Include the magni
tude and phase plots in one figure (
e.g.
, use
subplot
) Show the commands used to generate
the plot and include a hard copy the plot with your report.
Solution
a) The impulse response of each filter is
h
1
=
{
1
/
2
,
0
,
1
,
0
}
h
2
=
{
1
/
2
,

2
,
0
}
h
1
=
{
2
,
3
,
0
}
Therefore, the overall impulse response is
h
= (
h
1
+
h
2
)
*
h
3
Clearly
h
4
=
h
1
+
h
2
=
{
1
,

2
,
1
}
. Organizing the convolution operation in a table we have
h
4
:
1
2
1
h
3
:
2
3
2
4
2
3
6
3
2
1
4
3
and the answer is
h
=
{
2
,

1
,

4
,
3
}
b) The matlab (octave) code used to generate the plot shown is
% FIR Filtering
% Written by: Juan C. Cockburn (Feb 2008)
b=[2 1 4 3];
% Filter Coefficients
n_i=2;
% Initial time
x=[zeros(1,abs(n_i)) ones(1,10) zeros(1,10)];
% Input Signal
n_f=length(x)1+n_i;
% Final time
n=n_i:1:n_f;
% Time grid
y=filter(b,1,x);
% Find output
c
J.C. Cockburn
1 of 9
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Digital Signal Processing  EECC 451
Solutions  Homework # 6
stem(n,x,’b’);hold on
% Plot response
stem(n,y,’r’);hold off
xlabel(’Time [samples]’)
ylabel(’x[n] , y[n] ’)
title(’Response of FIR filter to input x[n]’)
5
0
5
10
15
20
3
2
1
0
1
2
3
Time [samples]
x[n] , y[n] 
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '08
 Cockburn
 Digital Signal Processing, Juan C. Cockburn

Click to edit the document details