DSP Major
DSP Major
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Normalized Frequency
DSP Assignment 4
PHAN ANH HUNG S3219592
cycles per sample, and the periodicity of the normalized distribution is 1. And when
the actual frequency has units of radians per second (angular frequency), the
normalized frequencies have units of radians per sample, and the periodicity of the
distribution is 2п.
- Modify the program to get the impulse response (h) from the frequency response and
plot it.
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Impulse Response
0.1
0.05
Amplitude
-0.05
-0.1
0 5 10 15 20 25
Time (sec)
2. Draw the block diagram of 3rd order FIR filter. Write the
difference equation for the filter and find out the output y[n] of
the filter when the filter coefficients are {b k }={1,-2,1, -1} and
the input sequence is
DSP Assignment 4
PHAN ANH HUNG S3219592
x[n]= [1,2,1,3,4,5,2,1,3]
N 0 1 2 3 4 5 6 7 8
X[n] 1 2 1 3 4 5 2 1 3
Y[n] 1 0 -2 2 -3 -1 -7 -10 -2
>> n = 0:7;
>> x = 4+3*cos((pi/3)*n-(pi/2))+3*cos((20*pi/21)*n);
>> bb = [1,2,1];
>> conv(bb,x)
ans =
7.0000 17.6316 23.7280 23.8583 15.9396 8.2611
8.1566 16.0418 16.0666 5.0981
y[n] = 2x[n]-2x[n-1]
The above equation is called a first difference equation filter,
but with a gain of 5. In Matlab you must define the vector bb
required for filter.
- Plot the first 50 samples of both waveforms x[n] and y[n] on the same figure using
subplot. Use the stem function to make a discrete time plot.
n = 0:49;
xx = 5*cos(0.125*pi*n+pi/4);
y = filter([2 -2], 1, xx);
subplot(2,1,1)
stem(xx)
title('xx')
DSP Assignment 4
PHAN ANH HUNG S3219592
xlabel('n')
ylabel('x[n]')
subplot(2,1,2)
stem(y)
title('y')
xlabel('n')
ylabel('y[n]')
xx
5
x[n]
-5
0 5 10 15 20 25 30 35 40 45 50
n
y
10
5
y[n]
-5
0 5 10 15 20 25 30 35 40 45 50
n
- Verify the amplitude and phase of x[n] directly from its plot in the time domain.
- Determine the frequency, amplitude and phase of y[n] directly from the plot.
Frequency = 1/16
Amplitude = π /4
Phase = 3.83
DSP Assignment 4
PHAN ANH HUNG S3219592
In hard copy
- What kind of filter does the above equation represent and why?
This is a 2nd – order IIP system, because ‘– 2x [n-2]’ is given in the equation.
- Where do the poles and zeros for the above equation lie. Show the pole-zero plot on
a unit circle.
- Write the equation for the impulse response h[n] and derive the coefficients for the
impulse response. Plot h[n] versus n and show that the impulse response never
reaches zero(is infinite).
DSP Assignment 4
PHAN ANH HUNG S3219592
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real Part
y[0] = -1/2y[-1] + x[ 0 ] = 1
y[1] = -1/2y[ 0 ] + x[ 1 ] = 1/2
y[2] = -1/2y[ 1 ] + x[ 2 ] = 3/4
y[3] = -1/2y[ 2 ] + x[ 3 ] = -3/8
y[n] = (-1/2) n −2 y[2] for n ≥ 3
N -1 0 1 2 3
X[n] 0 1 1 1 0
Y[n] 0 1 1/2 3/4 -3/8
DSP Assignment 4
PHAN ANH HUNG S3219592
- Find the poles of the system and plot their location in the z plane.
Zero = 0 and Pole = -0.9
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real Part
fc=200;
fs=1000;
DSP Assignment 4
PHAN ANH HUNG S3219592
[bb]=butter(4,fc/fs,'low');
w=-pi:(pi/50):pi;
xx=0:1:10;
H=freqz(bb,1,w);
[G,T]=impz(b,1,xx);
sys=H;
plot(w,abs(H));
x label('absolute value')
fvtool(bb)
x label ('magnitude and phase response')
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0
-4 -3 -2 -1 0 1 2 3 4
9. What are the advantages of IIR filter over FIR filter? Describe
the applications of these two types of filters?
IIR filters can achieve a given filtering characteristic using less memory and
calculations than a similar FIR filter.
10. Design an FIR filter. The specifications for this filter are given
below.
DSP Assignment 4
PHAN ANH HUNG S3219592
Implement the above designed FIR filter using DSP56803 processor. Using the
following equation and the filter coefficients, filter the composite signal and store the
samples of the output signal in another array in the DSP Processor. Export the output
signal to Matlab and plot the signal to observe the frequency of the signal.
M
y[n] = ∑bk × x[n − k ]
K =0
Where M is the order of the filter, y[n] is the output of the FIR filter, x[n] is the input,
b K are the filter coefficients.
DSP Assignment 4