Вы находитесь на странице: 1из 13

1. Reproduce Fig. 5.1 in Matlab.

>> b=[.2];
>> a= [1 -.8];
>> W = -pi:(2*pi)/8192:pi;
>> [H,W] = freqz(b,a,W);
>> plot(W,abs(H));
>> hold on
>> plot (W ,phase(H))

>> n=0:.5:100;
>> x=cos(2*pi*n/20);
>> plot(n,x)
>> hold on;
>> y=filter(b,a,x);
>> plot(n,y)
2. Plot the phase response Ψ(𝜔) and ∠𝐻(𝑒𝑗𝜔) of the system described in Ex. 5.3.

>> i= conv([1 1],[1 1]);


>> h=conv(i,i);
>> b=conv(h,i);
>> a=2.^6;
>> phi=angle(freqz(b,a,0:0.01:2*pi));
>> plot(0:.01:2*pi,phi);
>> plot(0:.01:2*pi,phi);

2 b)

>> w=0:0.01:2*pi;
>> phi1=-3*w;
>> plot(w,phi1)

3. Reproduce Fig. 5.3 in Matlab using two different methods described on pp 210.

>> n=0:100;
>> x=cos(.05*pi*n);
>> plot(n,x)
>> stem(n,x)
>> hold on
>> y=filter(1,[1 -0.8], x)
>> hold on
>> stem (n,y)

>> n=0:100;
>> h=0.8.^n;
>> x=cos(.05*pi*n);
>> y=conv(h,x)
>> stem(n,x)
>> hold on;
>> stem(y);

4. Reproduce Fig. 5.4 in Matlab.

>> a=[1 -0.7];


>> b=.3;
>> h=impz(b,a,50)
>> stem(h)

>> [xp,n]=unitpulse(0,0,5,9) %Set the path of book files accordingly


>> x=persegen(xp,10,49,0);
>> stem(x);
>> hold on;
>> y=filter(b,a,x);
>> stem(y);
5. Reproduce Fig. 5.5 in Matlab.

>> a=[1 -0.9];


>> b=.1;
>> impz(b,a,50)

System is with more memory now, as impulse response becomes zero after 40 samples as compared to
Problem 4 where it becomes zero after 15 samples.

>> [xp,n]=unitpulse(0,0,5,9);
>> x=persegen(xp,10,50,0);
>> stem(x);
>> hold on;
>> y=filter(b,a,x);
>> stem(y);

6. Reproduce Fig. 5.7 and Fig. 5.8 in Matlab.

>> a1=[1 -0.9 0.81];


>> a2=conv(a1,a1);
>> a4=conv(a2,a2);
>> a=conv(a4,a4);
>> b=[.0000005];
>> fvtool(b,a)
>> n=(-5:5);
>> s= 0.199*exp(-.125*n.^2);
>> s200=persegen(s,11,200,0);
>> s200r=s200';
>> xc=[cos(0.34*pi*(0:99)),cos(0.65*pi*(100:199))];
>> x=s200r.*xc;
>> plot(x)

>>om=linspace(0,pi,60)
>> plot(om,abs(dtft12(x,0,om)))
>> y=filter(b,a,x);
>> plot(y);

7. Reproduce Fig. 5.15 in Matlab with and without using contphase().


Hint: trapez(), phasez(), phasedelay().

>> b=[1 1.655 1.655 1];


>> a=[1 -1.57 1.264 -.4];
>> fvtool(b,a);
Set frequency range from 0 to 2 pi radians.
8. In order to enhance your understand of symmetry property of Fourier transform, reproduce Fig.
5.19 in Matlab.

>> b=[1];
>> a1=[1 -0.9*exp(j*pi/3)];
% System contains just two poles pk = 0.9e±jπ/3
.
>> a2=[1 -0.9*exp(-j*pi/3)];
>> a=conv(a1,a2);
>> fvtool(b,a);

9. Reproduce Fig. 5.20 in Matlab including both 𝑍𝑖𝑛 and 𝑍𝑜𝑢𝑡.

>> a= [1];
>> b=[1 -.5]; % H (z) = (z-0.5) z=0.5 is a zero inside unit circle
>> fvtool(b,a) % Set the frequency range from -pi to +pi from analysis parameters.

So phase response is continuous when zero inside unit circle.


>> a= [1];
>> b=[1 -1.5]; % H (z) = (z-1.5) z=1.5 is a zero outside unit circle
>> fvtool(b,a) % Set the frequency range from -pi to +pi from analysis parameters.

So phase response is discontinuous when zero inside unit circle.

10. Verify Eq. (5.118) analytically as well as graphically in Matlab.

Analytically peak of magnitude response can be shown to be located at ωc.


cos ωc = [(1 + r2)/(2r)] cos φ.
So

ωc = cos-1{[(1 + r2)/(2r)] cos φ}


ωc= 59.810 ≈ π/3

Graphical analysis

>> b=[0.1646];
>> a=[1 -0.9 0.81];
>> fvtool(b,a)

11. Find |(𝑒𝑗𝜑)| and |𝐻(𝑒𝑗[𝜑+0.5Δ𝜔])| where Δ𝜔 is given in (5.120).

Analyzing the figure from problem 10.

12. Verify graphically that system given in (5.121) provides improved BPF than system in (5.115).

The graph obtained for equation 5.115 is given in problem 11 which is replicated below.
Following commands will be used to obtain the graph of the system of equation 5.121.

The equation 5.121 is

>> b=[.1646 0 -0.1646];


>> a=[1 -0.9 .81];
>> fvtool(b,a)

The second graph shows the better band pass characteristics from 0 to π radians.

Вам также может понравиться