Chapter 6 Matlab Problems
Chapter 6 Matlab Problems
Rating
Bacani, Gabriel A.
EC42FB1
MATLAB Problems
6.19. Given a filter
H ( z )=
1+2 z1+ z 2
1
2
10.5 z +0.25 z
a. use the MATLAB functions filter() and filtic() to calculate the system response y(n) for n = 0, 1, 2, 3, . . . , 4
n
with the input of x(n) = (0:5) u(n) and initial conditions: x( - 1) = -1, y( - 2) = 2, and y( - 1) = 1;.
b. use the MATLAB function filter () to calculate the system response y(n) for n = 0, 1, 2, 3, . . . . 4 with the
input of x(n) = (0.5)nu(n) and zero initial conditions : x(-1) = 0, y(-2) = 0 and y(-1) = 0.
Solution:
b)
B=[ b o b 1 b 2 ] =[0 1]
A= [ a0 a1 a2 ]=[1 0.75 0.125]
a.
b.
c.
d.
plot the magnitude frequency response and phase response using MATLAB;
specify the type of filtering;
find the difference equation;
perform filtering, that is, calculate y(n) for the first 1,000 samples for each of
the following inputs and plot the filter outputs using MATLAB, assuming that
all initial conditions are zeros and the sampling rate is 8,000 Hz:
SOLUTION:
a)
[h w] = freqz([1 -1 1],[1 -0.90 0.81],1024)
phi = 180*unwrap(angle(h))/pi;
subplot(2,1,1), plot(w,abs(h)),grid;xlabel('Frequency (radians)'),
ylabel ('Magnitude')
subplot(2,1,2), plot(w,phi),grid;xlabel('Frequency (radians)'),
ylabel('Phase (degrees)')
b) Bandstop filter
c)
H ( z )=
Y (z)
1z1 + z2
=
X ( z) 10.9 z1 +0.81 z2
d)
1)
2)
3)
e)
1)
2)
y 3=1.00000.80710.1707 0.82820.06800.7321