1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

TTDSP solution manual bai 4 frLTAn

19 138 2

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 19
Dung lượng 346,67 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Laboratory Exercise 4 LINEAR, TIME-INVARIANT DISCRETE-TIME SYSTEMS: FREQUENCY-DOMAIN REPRESENTATIONS 4.1 TRANSFER FUNCTION AND FREQUENCY RESPONSE Project 4.1 Transfer Function Analysis

Trang 1

Laboratory Exercise 4 LINEAR, TIME-INVARIANT DISCRETE-TIME SYSTEMS:

FREQUENCY-DOMAIN REPRESENTATIONS

4.1 TRANSFER FUNCTION AND FREQUENCY RESPONSE

Project 4.1 Transfer Function Analysis

Answers:

Q4.1 The modified Program P3_1 to compute and plot the magnitude and phase spectra of

a moving average filter of Eq (2.13) for0 ≤ ω ≤ 2π is shown below:

% Program P3_1

% Evaluation of the DTFT

clf;

% Compute the frequency samples of the DTFT

M = input('Desired length of the filter = ');

w = 0:pi/(M^2):2*pi;

num = (1/M).*ones(1,M);

h = freqz(num,1, w);

% Plot the DTFT

subplot(2,1,1)

plot(w/pi,abs(h));grid

title('Magnitude Spectrum |H(e^{j\omega})|')

xlabel('\omega /\pi');

ylabel('Amplitude');

subplot(2,1,2)

plot(w/pi,angle(h));grid

title('Phase Spectrum arg[H(e^{j\omega})]')

xlabel('\omega /\pi');

ylabel('Phase in radians');

This program was run for the following three different values of Mand the plots of the

corresponding frequency responses are shown below:

M=4

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0

0.5

1

M agnitude S pe ctrum |H (e j ω)|

ω / π

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

-4

-2

0

2

4

P hase S pectru m arg[H (e j ω)]

ω / π

Trang 2

0 0.2 0.4 0 6 0.8 1 1 2 1 4 1 6 1 8 2

0

0 5

1

ω / π

0 0.2 0.4 0 6 0.8 1 1 2 1 4 1 6 1 8 2

-4

-2

0

2

4

P h ase S pe ctru m arg [H (e jω)]

ω / π

M=6

0 0 2 0 4 0 6 0 8 1 1 2 1 4 1 6 1 8 2

0

0 5

1

M aitu d S p c tr u m |H ( e j ω ) |

ω / π

0 0 2 0 4 0 6 0 8 1 1 2 1 4 1 6 1 8 2

- 4

- 2

0

2

4

P h s e S p c tr u m a r g [H ( e j ω ) ]

ω / π

M=3

The types of symmetries exhibited by the magnitude and phase spectra are even

and odd , respectively.

The type of filter represented by the moving average filter is low pass filter

The results of Question Q2.1 can now be explained as follows the moving average

filter is the low pass filter so the signal s2 is suppressed because s2 is the high frequency signal.

Q4.2 The plot of the frequency response of the causal LTI discrete-time system of Question

Q4.2 obtained using the modified program is given below:

Trang 3

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

0

0 5

1

ω π

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 2

- 1

0

1

2

P h s e S p c t r u m a r g [ H ( e j ω ) ]

ω π

The type of filter represented by this transfer function is band pass filter

Q4.3 The plot of the frequency response of the causal LTI discrete-time system of Question

Q4.3 obtained using the modified program is given below:

0

1

ω π

0

2

4

ω π

The type of filter represented by this transfer function is band pass filter

The difference between the two filters of Questions 4.2 and 4.3 is that the attenuation of the

phase spectrum of the filter of the Question 4.3 is faster than the filter of the Question

4.2.

I shall choose the filter of Question Q4.2 for the following reason The attenuation of

the phase spectrum of the filter of the Question 4.3 is faster so the amount of the signal distortion is more significant.

Q4.4 The group delay of the filter specified in Question Q4.4 and obtained using the

function grpdelayis shown below:

Trang 4

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

0

1

2

3

4

5

6

7

8

From this plot we make the following observations: the difference phase is the largest

at the frequency of 0.3 that means the amount of the signal distortion is the largest

at the frequency of 0.3

Q4.5 The plots of the first 100 samples of the impulse responses of the two filters of

Questions 4.2 and 4.3 obtained using the program developed in Question Q3.50 are shown below:

- 0 2

- 0 2

- 0 1

- 0 1

- 0 0

0

0 0

0 1

0 1

t h i n v e r s e o f a r a t i o l z - t r a s f o r m

- 1 5

- 1

- 0 5

0

0 5

1

1 5

2x1

From these plots we make the following observations: that the filter of the question

4.2 is stable and the one of the question 4.3 is not stable

The transfer function in the question 4_2

Trang 5

Q4.6 The pole-zero plots of the two filters of Questions 4.2 and 4.3 developed using zplane are shown below:

-1 -0.5 0 0.5 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Real Part

-1.5 -1 -0.5 0 0.5 1 1.5 -1

-0.5 0 0.5 1

Real Part

From these plots we make the following observations: that the filter of the question 4.2 is casual and stable and the filter of the question 4.3 is not stable

4.2 TYPES OF TRANSFER FUNCTIONS

Project 4.2 Filters

% Program P4_1

% Impulse Response of Truncated Ideal Lowpass Filter

clf;

fc = 0.25;

n = [-6.5:1:6.5];

y = 2*fc*sinc(2*fc*n);k = n+6.5;

stem(k,y);title('N = 13');axis([0 13 -0.2 0.6]);

xlabel('Time index n');ylabel('Amplitude');grid;

Answers:

Q4.7 The plot of the impulse response of the approximation to the ideal lowpass filter

obtained using Program P4_1 is shown below:

0

The length of the FIR lowpass filter is 13

The pole – zero plot of the filter

of question 4_2

The pole – zero plot of the filter

of question 4_3

Trang 6

The statement in Program P4_1 determining the filter length is

n = [-6.5:1:6.5];

The parameter controlling the cutoff frequency is fc.

Q4.8 The required modifications to Program P4_1 to compute and plot the impulse

response of the FIR lowpass filter of Project 4.2 with a length of 20 and a cutoff frequency of ω c = 0.45are as indicated below:

% Program P4_1

% Impulse Response of Truncated Ideal Lowpass Filter

clf;

fc = 0.45/(2*pi);

n = [-10:1:10];

y = 2*fc*sinc(2*fc*n);k = n+10;

stem(k,y);title('N = 21');axis([0 20 -0.2 1]);

xlabel('Time index n');ylabel('Amplitude');grid;

The plot generated by running the modified program is given below

0 2 4 6 8 1 1 1 1 1 2

-0 2

0

0 2

0 4

0 6

0 8

N = 2

T i m e i n x n

Q4.9 The required modifications to Program P4_1 to compute and plot the impulse

response of the FIR lowpass filter of Project 4.2 with a length of 15 and a cutoff frequency of

ω c = 0.65are as indicated below:

% Program P4_1

% Impulse Response of Truncated Ideal Lowpass Filter

clf;

fc = 0.65/(2*pi);

n = [-7.5:1:7.5];

y = 2*fc*sinc(2*fc*n);k = n+7.5;

stem(k,y);title('N = 21');axis([0 20 -0.2 1]);

xlabel('Time index n');ylabel('Amplitude');grid;

The plot generated by running the modified program is given below:

0

Trang 7

Q4.10 The MATLAB program to compute and plot the amplitude response of the FIR lowpass filter of Project 4.2 is given below:

% Program P4_1

% Impulse Response of Truncated Ideal Lowpass Filter

clf;

fc = 0.25;

n = [-6.5:13/511:6.5];

y = 2*fc*sinc(2*fc*n);

Y=fft(y);

Plot(abs(Y));

Xlable(‘w/pi’);

Ylable(‘amplitude’);

Plots of the amplitude response of the lowpass filter for several values of Nare shown

below:

0

5

1

1

2

2

3

3

4

4

From these plots we can make the following observations that the transition of the

filter is approximately immediate.

A copy of Program P4_2 is given below:

% Program P4_2

% Gain Response of a Moving Average Lowpass Filter

clf;

M = 2;

num = ones(1,M)/M;

[g,w] = gain(num,1);

plot(w/pi,g);grid

axis([0 1 -45 0])

xlabel('\omega /\pi');ylabel('Gain in dB');

title(['M = ', num2str(M)])

Answers:

Q4.11 A plot of the gain response of a length-2 moving average filter obtained using

Program P4_2 is shown below:

Trang 8

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 4

- 4

- 3

- 3

- 2

- 2

- 1

- 1

-5

From the plot it can be seen that the 3-dB cutoff frequency is at0.5pi.

Q4.12 The required modifications to Program P4_2 to compute and plot the gain response

of a cascade ofKlength-2 moving average filters are given below:

% Gain Response of a cascade of K length -2 moving Average

%Lowpass Filter

clf;

k=input('the number of sections of a cascade system:');

M = 2;

num = ones(1,M)/M;

w = 0:pi/255:pi;

h = freqz(num,1,w);

ha=h.^k;

g = 20*log10(abs(ha));

plot(w/pi,g);grid

axis([0 1 -45 0])

xlabel('\omega /\pi');ylabel('Gain in dB');

title(['M = ', num2str(M)])

The plot of the gain response for a cascade of 3 sections obtained using the modified

program is shown below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 4

- 4

- 3

- 3

- 2

- 2

- 1

- 1

- 5

0

ω π

M = 2

From the plot it can be seen that the 3-dB cutoff frequency of the cascade is at 0.3pi. Q4.13 The required modifications to Program P4_2 to compute and plot the gain response

of the highpass filter of Eq (4.42) are given below:

% Program P4_2

% Gain Response of a Moving Average Lowpass Filter

clf;

M=input('length of the highpass filter:');

num = zeros(1,M);

for k=0:M-1,

num(k+1)=num(k+1)+(-1)^k;

Trang 9

num=num/M;

[g,w] = gain(num,1);

plot(w/pi,g);grid

axis([0 1 -14 0])

xlabel('\omega /\pi');ylabel('Gain in dB');

title(['M = ', num2str(M)])

The plot of the gain response for M = 5obtained using the modified program

is shown below:

0

From the plot we can see that the 3-dB cutoff frequency is at 0.82pi

Q4.14 From Eq (4.16) for a 3-dB cutoff frequency ω c at0.45 π we obtain α = 0.08.

Substituting this value of α in Eqs (4.15) and (4.17) we arrive at the transfer function of the first-order IIR lowpass and highpass filters, respectively, given by

HLP(z) =

1

1

08 0 1

) 1

( 46 0

+

z z

HHP(z) = 1

1

08 0 1

) 1

( 54 0

z z

The plots of their gain responses obtained using MATLAB are shown below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

-1

-1

-1

- 8

- 6

- 4

- 2

0

l o w p s i t e r w c = 0 4 i

Trang 10

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

-8

-6

-4

-2

0

From these plots we observe that the designed filters do meet the specifications.

A plot of the magnitude response of the sum HLP(z) + HHP(z) obtained using MATLAB

is given below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 1

- 1

- 1

- 8

- 6

- 4

- 2

0

l o w p s i t e r w c = 0 4 i

From this plot we observe that the two filters are allpass-complementary.

A plot of the sum of the square-magnitude responses of HLP(z) and HHP(z) obtained using MATLAB is given below:

0

1

s q r e - a m p l t u r e s p s e o f h i g s i t e r w c = 0 4 i

0

1

s q r e - a m p l t u r e s p s e o f h i g s i t e r w c = 0 4 i

From this plot we observe that the two filters arepower-complementary

Trang 11

Q4.15 From Eq (4.24), we get substituting K = 10 , B = 1.866.

Substituting this value of B and ω c = 0.3 π in Eq (4.23) we obtainα = -0.311.

Using this value of α in Eq (4.22) we arrive at the transfer function of the cascade

of 10 IIR lowpass filters as

HLP,10(z) = 1 – α

2 ⋅ 1 + z 1

1 – α z 1

10

=

10 1 1

311 0 1

) 1 ( 6555 0





 +

+

z z

Substituting ω c = 0.3 π in Eq (4.16) we obtainα = 0.325.

Using this value of α in Eq (4.15) we arrive at the transfer function of a first-order IIR lowpass filter

HLP,1(z) = 1 – α

2 ⋅ 1 + z 1

1 – α z 1= 11

325 0 1

) 1

( 3375 0

+

z z

The gain responses of HLP,10(z) and HLP,1(z) plotted using MATLAB are shown below:

-5 0

g i n r e s p s e o f l o w p s i t e r w c = 0 3 i

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 1

- 9

- 8

- 7

- 6

- 5

- 4

- 3

- 2

- 1

0

ω π

g i n r e s p s e o f 1 t h - o r d r l o w p s i t e r w c = 0 3 i

From these plots we make the following observation the transition of the 10th-order lowpass filter is more immediate than the first-order lowpass filter.

Q4.16 Substituting ω o = 0.61 π in Eq (4.19) we get β = cos(0.61 π ) = -0.339.

Trang 12

Substituting ∆ω3dB = 0.15 π in Eq (4.20) we get (1 + α2)cos(0.15 π ) − 2 α = 0,

whose solution yields α =0.6128 andα = 1.6319

Substituting the value of β and the first value of α in Eq (4.18) we arrive at the transfer function of the IIR bandpass transfer function

HBP,1(z) =

2 1

2

6128 0 547

0 1

) 1 ( 1936 0

+ +

z z

z

Substituting the value of β and the second value of α in Eq (4.18) we arrive at the transfer function of the IIR bandpass transfer function

HBP,2(z) =

2 1

2

6319 1 892

0 1

) 1 ( 316 0

+ +

z z

z

Next using the zplane command we find the pole locations of HBP,1(z) and

HBP,2(z) from which we conclude that the stable transfer function HBP(z) is given

by

HBP,1(z) =

2 1

2

6128 0 547

0 1

) 1 ( 1936 0

+ +

z z

z

The plot of the gain response of the stable transfer function HBP(z) obtained using MATLAB is shown below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

-2

-2

-1

-1

- 5

0

ω π

b s i t e r B W = 0 1 i

Using the same value of α and β in Eq (4.21) we next obtain the transfer function

of a stable IIR bandstop filter as

HBS(z) =

2 1

2 1

6128 0 547

0 1

) 678

0 1 ( 8064 0

+ +

+ +

z z

z z

The plot of the gain response of the transfer function HBS(z) obtained using MATLAB is shown below:

Trang 13

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

- 3

- 3

- 2

- 2

- 1

- 1

-5

0

From these plots we observe that the designed filters do meet the specifications.

A plot of the magnitude response of the sum HBP(z) + HBS(z) obtained using MATLAB

is given below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

0

0 2

0 4

0 6

0 8

1

1 2

1 4

1 6

1 8

2

ω π

From this plot we observe that the two filters are allpass-complementary.

A plot of the sum of the square-magnitude responses of HBP(z) and HBS(z) obtained using MATLAB is given below:

0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 1

0

0 1

0 2

0 3

0 4

0 5

0 6

0 7

0 8

0 9

1

ω π

d b s i t e r B W = 0 1 π

0

1

ω π

From this plot we observe that the two filters are power-complementary

Trang 14

Q4.17 The transfer function of a comb filter derived from the prototype FIR lowpass filter

of Eq (4.38) is given by

G(z) = H0(zL) = 0.5(1+z-L)

Plots of the magnitude response of the above comb filter for the following values of L are shown below:

0

1

ω / π

m a i t u r e s p s e o f h a v e c o m b i t e r L

0 0 2 0 4 0 6 0 8 1 1 2 1 4 1 6 1 8 2

0

0 2

0 4

0 6

0 8

1

1 2

m a i t u r e s p s e o f h a v e c o m b i t e r L = 6

From these plots we observe that the comb filter has mutilpe notches at ω k=

(2k+1)pi/L and L peaks at ω k = 2k*pi/L, where k = 0, 1, , L-1.

Q4.18 The transfer function of a comb filter derived from the prototype FIR highpass filter

of Eq (4.42) with M = 2 is given by

G(z) = H1(zL) = 0.5(1-z-L)

Plots of the magnitude response of the above comb filter for the following values of L are shown below -

0

1

m a i t u r e s p s e o f h a v e c o m b i t e r L = 4

Trang 15

0 0 2 0 4 0 6 0 8 1 1 2 1 4 1 6 1 8 2

0

0 1

0 2

0 3

0 4

0 5

0 6

0 7

0 8

0 9

ω / π

From these plots we observe that the comb filter has multiple notches at ω k =

k2pi/L

and multiple peaks at ω k = pi(2k+1)/L.

Q4.19 A copy of Program P4_3 is given below:

% Program P4_3

% Zero Locations of Linear Phase FIR Filters

clf;

b = [1 -8.5 30.5 -63];

num1 = [b 81 fliplr(b)];

num2 = [b 81 81 fliplr(b)];

num3 = [b 0 -fliplr(b)];

num4 = [b 81 -81 -fliplr(b)];

n1 = 0:length(num1)-1;

n2 = 0:length(num2)-1;

subplot(2,2,1); stem(n1,num1);

xlabel('Time index n');ylabel('Amplitude'); grid;

title('Type 1 FIR Filter');

subplot(2,2,2); stem(n2,num2);

xlabel('Time index n');ylabel('Amplitude'); grid;

title('Type 2 FIR Filter');

subplot(2,2,3); stem(n1,num3);

xlabel('Time index n');ylabel('Amplitude'); grid;

title('Type 3 FIR Filter');

subplot(2,2,4); stem(n2,num4);

xlabel('Time index n');ylabel('Amplitude'); grid;

title('Type 4 FIR Filter');

pause

subplot(2,2,1); zplane(num1,1);

title('Type 1 FIR Filter');

subplot(2,2,2); zplane(num2,1);

title('Type 2 FIR Filter');

subplot(2,2,3); zplane(num3,1);

title('Type 3 FIR Filter');

subplot(2,2,4); zplane(num4,1);

title('Type 4 FIR Filter');

disp('Zeros of Type 1 FIR Filter are');

disp(roots(num1));

disp('Zeros of Type 2 FIR Filter are');

disp(roots(num2));

disp('Zeros of Type 3 FIR Filter are');

disp(roots(num3));

Ngày đăng: 25/12/2017, 08:31

TỪ KHÓA LIÊN QUAN

w