Vous êtes sur la page 1sur 25

HONG MINH PHC TRN THANH HNG

GROUP

LABORATORY EXERCISE 3
DISCRETE-TIME SIGNALS: FREQUENCY-DOMAIN REPRESENTATIONS
3.1 DISCRETE-TIME FOURIER TRANSFORM DTFT Computation

Project 3.1

A copy of Program P3_1 is given below: clf; % Compute the frequency samples of the DTFT w = -4*pi:8*pi/511:4*pi; num = [2 1];den = [1 -0.6]; h = freqz(num, den, w); % Plot the DTFT subplot(2,2,1) plot(w/pi,real(h));grid title('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,imag(h));grid title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,4) plot(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase in radians'); Answers: Q3.1 The expression of the DTFT being evaluated in Program P3_1 is

X ( e j ) =

2 + e j 1 0.6e j

The function of the pause command is Q3.2

is used to wait for user response

The plots generated by running Program P3_1 are shown below:

Real part of H(ej ) 8 6 Amplitude 4 2 0 -4 Amplitude 4 2 0 -2 -4 -4

Imaginary part of H(ej)

-2

0 /

-2

/
Phase Spectrum arg[H(ej )] 2 Phase in radians 1 0 -1 -2 -4

Magnitude Spectrum |H(ej)| 8 6 Amplitude 4 2 0 -4

-2

0 /

-2

The DTFT is a periodic function of w. Its period is - 1 The types of symmetries exhibited by the four plots are as follows : x[n] is a real sequence, so the real and the magnitude of its DTFT are even symmetry, the imaginary and the phase of its DTFT are odd symmetry. Q3.3 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.3 are given below: % Compute the frequency samples of the DTFT w = 0:pi/511:pi; num = [0.7 -0.5 0.3 1];den = [1 0.3 -0.5 0.7]; h = freqz(num, den, w); % Plot the DTFT subplot(2,2,1) plot(w/pi,real(h));grid title('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,imag(h));grid title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,4) plot(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase in radians'); The plots generated by running the modified Program P3_1 are shown below:

Real part of H(ej ) 1 0.5 Amplitude 0 -0.5 -1 Amplitude 1 0.5 0 -0.5 -1

Imaginary part of H(ej)

0.5 1 / Magnitude Spectrum |H(ej)| Phase in radians

0.5 Phase Spectrum arg[H(ej)]

4 2 0 -2 -4

Amplitude

0.5 /

0.5

The DTFT is a periodic function of Its period is - 1

w.

The jump in the phase spectrum is caused by - The jump in the phase spectrum is caused by an artifact of the arctangent function inside angle that signify zeros in the frequency response. The phase spectrum evaluated with the jump removed by the command unwrap is as given below:

Q3.4

The required modifications to Program P3_1 to evaluate the given DTFT of Q3.4 are given below: % Compute the frequency samples of the DTFT w = -4*pi:8*pi/511:4*pi; num = [1 3 5 7 9 11 13 15 17];den = 1; h = freqz(num, den, w); % Plot the DTFT subplot(2,2,1) plot(w/pi,real(h));grid title('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,imag(h));grid

title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,4) plot(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase in radians'); The plots generated by running the modified Program P3_1 are shown below:
Real part of H(ej ) 100 100 50 Amplitude 0 -50 -100 -4 Imaginary part of H(ej )

Amplitude

50

-50 -4

0 2 4 / Magnitude Spectrum |H(ej)|

-2

-2

Phase Spectrum arg[H(ej )] 4 Phase in radians 2 0 -2 -4 -4

100

Amplitude

50

0 -4

-2

0 /

-2

0 /

The DTFT is a periodic function of w. Its period is - 1 The jump in the phase spectrum is caused by an artifact of the arctangent function inside angle that signify zeros in the frequency response. Q3.5 The required modifications to Program P3_1 to plot the phase in degrees are indicated below: plot(w/pi,angle(h)*180/pi);grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase in degrees');

Project 3.2 Answers: Q3.6

DTFT Properties

The modified Program P3_2 created by adding appropriate comment statements, and adding program statements for labeling the two axes of each plot being generated by the program is given below: % Program P3_2 % Time-Shifting Properties of DTFT

clf; w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 10; num = [1 2 3 4 5 6 7 8 9]; h1 = freqz(num, 1, w); h2 = freqz([zeros(1,D) num], 1, w); subplot(2,2,1) plot(w/pi,abs(h1));grid title('Magnitude Spectrum of Original Sequence') subplot(2,2,2) plot(w/pi,abs(h2));grid title('Magnitude Spectrum of Time-Shifted Sequence') subplot(2,2,3) plot(w/pi,angle(h1));grid title('Phase Spectrum of Original Sequence') subplot(2,2,4) plot(w/pi,angle(h2));grid title('Phase Spectrum of Time-Shifted Sequence') The parameter controlling the amount of time-shift is w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 10; num = [1 2 3 4 5 6 7 8 9]; h1 = freqz(num, 1, w); h2 = freqz([zeros(1,D) num], 1, w); Q3.7 The plots generated by running the modified program are given below:
Magnitude Spectrum of Original Sequence Magnitude Spectrum of Time-Shifted Sequence 60 60

40

40

20

20

0 -1

-0.5

0.5

0 -1

-0.5

0.5

Phase Spectrum of Original Sequence Phase Spectrum of Time-Shifted Sequence 4 4 2 0 -2 -4 -1 2 0 -2 -4 -1

-0.5

0.5

-0.5

0.5

From these plots we make the following observations: magnitude spectrum is not changed and phase spectrum is changed. Q3.8 Program P3_2 was run for the following value of the time-shift - 5 The plots generated by running the modified program are given below:

Magnitude Spectrum of Original Sequence Magnitude Spectrum of Time-Shifted Sequence 60 60

40

40

20

20

0 -1

-0.5

0.5

0 -1

-0.5

0.5

Phase Spectrum of Original Sequence Phase Spectrum of Time-Shifted Sequence 4 4 2 0 -2 -4 -1 2 0 -2 -4 -1

-0.5

0.5

-0.5

0.5

From these plots we make the following observations: when the time-shift is more greater, and phase spectrum is is changed more. Q3.9 Program P3_2 was run for the following values of the time-shift and for the following values of length for the sequence - D = 15; num = [2 7 9 4 5 1 3 8 4]; The plots generated by running the modified program are given below:
Magnitude Spectrum of Original Seq 60 Magnitude Spectrum of T-Shifted Seq 60

40

40

20

20

0 -1

-0.5

0.5

0 -1

-0.5

0.5

Phase Spectrum of Original Sequence Phase Spectrum of Time-Shifted Sequence 4 4 2 0 -2 -4 -1 2 0 -2 -4 -1

-0.5

0.5

-0.5

0.5

From these plots we make the following observations: for two different sequences of varying lengths and two different time-shifts, magnitude spectrum is not changed and phase spectrum is changed. From these plots we make the following observations: Q3.10 The modified Program P3_3 created by adding appropriate comment statements, and adding program statements for labeling the two axes of each plot being generated by the program is given below: % Frequency-Shifting Properties of DTFT

clf;

w = -pi:2*pi/255:pi; wo = 0.4*pi; num1 = [1 3 5 7 9 11 13 15 17]; L = length(num1); h1 = freqz(num1, 1, w); n = 0:L-1; num2 = exp(wo*i*n).*num1; h2 = freqz(num2, 1, w); subplot(2,2,1) plot(w/pi,abs(h1));grid xlabel('\omega /\pi'); ylabel('Amplitude'); title('Magnitude Spectrum of Original Seq') subplot(2,2,2) plot(w/pi,abs(h2));grid xlabel('\omega /\pi'); ylabel('Amplitude'); title('Magnitude Spectrum of Frequency-Shifted Seq') subplot(2,2,3) plot(w/pi,angle(h1));grid xlabel('\omega /\pi'); ylabel('Amplitude'); title('Phase Spectrum of Original Seq') subplot(2,2,4) plot(w/pi,angle(h2));grid xlabel('\omega /\pi'); ylabel('Amplitude'); title('Phase Spectrum of Frequency-Shifted Seq') The parameter controlling the amount of frequency-shift is - wo Q3.11 The plots generated by running the modified program are given below:
Magnitude Spectrum of Original Seq Magnitude Spectrum of Frequency-Shifted Seq 100 100

Amplitude

50

Amplitude 0 0.5 1 / Phase Spectrum of Original Seq -0.5

50

0 -1

0 -1

-0.5

0.5

/
Phase Spectrum of Frequency-Shifted Seq 4 2 Amplitude 0 -2 -4 -1

4 2 Amplitude 0 -2 -4 -1

-0.5

0 /

0.5

-0.5

0.5

From these plots we make the following observations: both magnitude spectrum and phase spectrum is shifted. The delay is 0.4*pi. Q3.12 Program P3_3 was run for the following value of the frequency-shift

The plots generated by running the modified program are given below:

From these plots we make the following observations: when the frequency-shift is reatger, the shift is more than. Q3.13 Program P3_3 was run for the following values of the frequency-shift and for the following values of length for the sequence - wo=0.8*pi, num1=17:-2:1 The plots generated by running the modified program are given below:
Magnitude Spectrum of Original Seq Magnitude Spectrum of Frequency-Shifted Seq 100 100

Amplitude

50

Amplitude 0 0.5 1 / Phase Spectrum of Original Seq -0.5

50

0 -1

0 -1

-0.5

0.5

/
Phase Spectrum of Frequency-Shifted Seq 2 1 Amplitude 0 -1 -2 -1

2 1 Amplitude 0 -1 -2 -1

-0.5

0 /

0.5

-0.5

0.5

From these plots we make the following observations:with the change above isnt change Frequency-Shifting Property. Q3.14 The modified Program P3_4 created by adding appropriate comment statements, and adding program statements for labeling the two axes of each plot being generated by the program is given below: % Program P3_4 % Convolution Property of DTFT clf; w = -pi:2*pi/255:pi; x1 = [1 3 5 7 9 11 13 15 17]; x2 = [1 -2 3 -2 1]; y = conv(x1,x2); h1 = freqz(x1, 1, w);

h2 = freqz(x2, 1, w); hp = h1.*h2; h3 = freqz(y,1,w); subplot(2,2,1) plot(w/pi,abs(hp));grid title('Product of Magnitude Spectra'); xlabel('\omega/\pi'); ylabel('amplitude'); subplot(2,2,2) plot(w/pi,abs(h3));grid title('Magnitude Spectrum of Convolved Sequence'); xlabel('\omega/\pi'); ylabel('amplitude'); subplot(2,2,3) plot(w/pi,angle(hp));grid title('Sum of Phase Spectra'); xlabel('\omega/\pi'); ylabel('amplitude'); subplot(2,2,4) plot(w/pi,angle(h3));grid title('Phase Spectrum of Convolved Sequence'); xlabel('\omega/\pi'); ylabel('amplitude');

Q3.15 The plots generated by running the modified program are given below:
P u o aiu Sc rdt fM td pta oc g e er n 1 0 0 a p m litu e d Miu Sc mC o deee a td ptuo o leSuc g e er f n v qn n v 1 0 0 a p m litu e d

5 0

5 0

0 1

0 / S o hepta u fPsSc m a er

-. 0 5

0 . 5

4 a p m litu e d 2 0 2 4 1 a p m litu e d

-. 0 5 0 / PsSc mCo deee heptu o o leSuc a er f n v qn v 4 2 0 2 4 1

0 1

0 . 5

-. 0 5

0 /

0 . 5

-. 0 5

0 /

0 . 5

From these plots we make the following observations: with two way to compute give the same result. Q3.16 Program P3_4 was run for the following two different sets of sequences of varying lengths x1 = [1 3 5 7 9 11 ]; x2 = [1 -2 3 ]; The plots generated by running the modified program are given below:

Product of Magnitude Spectra 80 60 amplitude 40 20 0 -1

Magnitude Spectrum of Convolved Sequence 80 60 amplitude 40 20 0 -1

0 0.5 / Sum of Phase Spectra

-0.5

-0.5

0.5

/
Phase Spectrum of Convolved Sequence 4 2 amplitude 0 -2 -4 -1

4 2 amplitude 0 -2 -4 -1

-0.5

0 /

0.5

-0.5

0.5

From these plots we make the following observations: the above property is not change. Q3.17 The modified Program P3_5 created by adding appropriate comment statements, and adding program statements for labeling the two axes of each plot being generated by the program is given below: % Program P3_5 % Modulation Property of DTFT clf; w = -pi:2*pi/255:pi; x1 = [1 3 5 7 9 11 13 15 17]; x2 = [1 -1 1 -1 1 -1 1 -1 1]; y = x1.*x2; h1 = freqz(x1, 1, w); h2 = freqz(x2, 1, w); h3 = freqz(y,1,w); subplot(3,1,1) plot(w/pi,abs(h1));grid title('Magnitude Spectrum of First Sequence'); xlabel('\omega/\pi'); ylabel('amplitude'); subplot(3,1,2) plot(w/pi,abs(h2));grid title('Magnitude Spectrum of Second Sequence'); xlabel('\omega/\pi'); ylabel('amplitude'); subplot(3,1,3) plot(w/pi,abs(h3));grid title('Magnitude Spectrum of Product Sequence'); xlabel('\omega/\pi'); ylabel('amplitude');

Q3.18

The plots generated by running the modified program are given below:

10

Magnitude Spectrum of First Sequence 100 amplitude 50 0 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

/
Magnitude Spectrum of Second Sequence 10 amplitude 5 0 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

/
Magnitude Spectrum of Product Sequence amplitude 100 50 0 -1 -0.8 -0.6 -0.4 -0.2 0 / 0.2 0.4 0.6 0.8 1

From these plots we make the following observations: Q3.19 Program P3_5 was run for the following two different sets of sequences of varying lengths x1 = [1 3 5 7 9 11 ]; x2 = [1 -2 3 5 7 3 ]; The plots generated by running the modified program are given below:
Magnitude Spectrum of First Sequence 40 amplitude 20 0 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

/
Magnitude Spectrum of Second Sequence 20 amplitude 10 0 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

/
Magnitude Spectrum of Product Sequence amplitude 200 100 0 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

From these plots we make the following observations: Q3.20 The modified Program P3_6 created by adding appropriate comment statements, and adding program statements for labeling the two axes of each plot being generated by the program is given below: % Time Reversal Property of DTFT clf; w = -pi:2*pi/255:pi; num = [1 2 3 4]; L = length(num)-1; h1 = freqz(num, 1, w);

11

h2 = freqz(fliplr(num), 1, w); h3 = exp(w*L*i).*h2; subplot(2,2,1) plot(w/pi,abs(h1));grid xlabel('\omega/\pi'); ylabel('amplitude'); title('Magnitude Spectrum of Original Seq') subplot(2,2,2) plot(w/pi,abs(h3));grid xlabel('\omega/\pi'); ylabel('amplitude'); title('Magnitude Spectrum of Time-Reversed Seq') subplot(2,2,3) plot(w/pi,angle(h1));grid xlabel('\omega/\pi'); ylabel('amplitude'); title('Phase Spectrum of Original Seq') subplot(2,2,4) plot(w/pi,angle(h3));grid xlabel('\omega/\pi'); ylabel('amplitude'); title('Phase Spectrum of Time-Reversed Seq') The program implements the time-reversal operation as follows: h2 = freqz(fliplr(num), 1, w); h3 = exp(w*L*i).*h2; Q3.21 The plots generated by running the modified program are given below:
Magnitude Spectrum of Original Seq 10 8 amplitude 6 4 2 -1 amplitude 0 0.5 1 / Phase Spectrum of Original Seq -0.5 Magnitude Spectrum of Time-Reversed Seq 10 8 6 4 2 -1

-0.5

0.5

/
Phase Spectrum of Time-Reversed Seq 4 2 amplitude 0 -2 -4 -1

4 2 amplitude 0 -2 -4 -1

-0.5

0 /

0.5

-0.5

0.5

From these plots we make the following observations both magnitude spectrum and phase spectrum is reverted in frequency domain. Q3.22 Program P3_6 was run for the following two different sets of sequences of varying lengths: The plots generated by running the modified program are given below: num = [5 7 3 4 1];

12

a pt d ml u e i

1 5 1 0 5 0 1

a pt d ml u e i 0 / 0 . 5 1

Mdpuf rne au emiiaq g e c ogS n Sr Ol i t t 2 0

Mdpufi ev dq au em - e S g e c o Ree n Sr T e i t t mr s 2 0 1 5 1 0 5 0 1

-5 0 .

-5 0 .

0 /

0 . 5

a pt d ml u e i

2 0 2 4 1

a pt d ml u e i 0 / 0 . 5 1

P Sr oiiaq h puf rne a emgS s c Ol e t 4

P Sr o ev dq h pufi - e S a em Ree s c Te e t mr s 4 2 0 2 4 1

-5 0 .

-5 0 .

0 /

0 . 5

num = [11 2 7 8 6 4 8];


M iu Scu o r i a e a t d p t mOn S g e er f i l q n g 6 0 a p m litu e d M iu Scu o i e ereS a t d p t mT - vs e g e er f m e d q n R 6 0 a p m litu e d 0 / PsScu o r i a e h e p t mOn S a er f i l q g -. 0 5 0 . 5 1

4 0

4 0

2 0

2 0

0 1

0 1

-. 0 5

0 /

0 . 5

4 a p m litu e d 2 0 2 4 1 a p m litu e d -. 0 5 0 / 0 . 5 1

PsScu o i e ereS h e p t mT - vsd e a er f m e R q 4 2 0 2 4 1

-. 0 5

0 /

0 . 5

From these plots we make the following observations: the time-reversal property is not change 3.2 DISCRETE FOURIER TRANSFORM DFT and IDFT Computations

Project 3.3 Answers: Q3.23

The MATLAB program to compute and plot the L-point DFT X[k] of a length-N sequence x[n] with L and then to compute and plot the IDFT of X[k] is given below: % Evaluation of the DFT clf; % Compute the frequency samples of the DFT xn = [1 3 5 7 9 11 13 15 17 2];den = 1; N=length(xn); k=0:N-1; w=2*pi*k/N; Xn = freqz(xn, den, w); %Plot the x[n]) subplot(3,1,1) stem(k,xn);grid title('x[n]') xlabel('n'); ylabel('Amplitude'); % Plot the DFT subplot(3,1,2)

13

stem(w,real(Xn));grid title('Real part of X[n]') xlabel('w'); ylabel('Amplitude'); subplot(3,1,3) stem(w,imag(Xn));grid title('Imaginary part of X[n]') xlabel('w'); ylabel('Amplitude');

Am litu e p d

xn [] 2 0 1 0 0 0 1 2 3 4 n Rapr oX] el a f [ t n 10 0 0 -0 10 0 1 2 3 w I ainr pr oX] m a a f [ g y t n 4 5 6 5 6 7 8 9

Am litu e p d

Am litu e p d

5 0 0 -0 5 0 1 2 3 w 4 5 6

The DFT and the IDFT pairs generated by running the program for sequences of different lengths N and for different values of the DFT length L are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: Q3.24 The MATLAB program to compute the N-point DFT of two length-N real sequences using a single N-point DFT and compare the result by computing directly the two N-point DFTs is given below: < Insert program code here. Copy from m-file(s) and paste. > The DFTs generated by running the program for sequences of different lengths N are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: Q3.25 The MATLAB program to compute the 2N-point DFT of a length-2N real sequence using a single N-point DFT and compare the result by computing directly the 2N-point DFT is shown below: < Insert program code here. Copy from m-file(s) and paste. > The DFTs generated by running the program for sequences of different lengths 2N are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: Project 3.4 DFT Properties

14

Answers: Q3.26 Q3.27 The purpose of the command rem in the function circshift is used to get remainder after division between abs(M) and length(x). The function circshift operates as follows: the first, we compare value between abs(M) and length(x). Then we get remainder after division between abs(M) and length(x), then this value is allocated to M. And the last, as the case maybe whether M is possitive or negative, x[n] is advanced or delayed, respectively. The purpose of the operator ~= in the function circonv is used to compare the length betwwen x[1] and x[2]. The function circonv operates as follows: the first, we compare the length between x1 and x2, to continue, the length of x1 must same the length of x2. Then, we get mirror x2. The last we tocombine circularly shifting x2, for loop and sum function to compute as known expression about the circular convolution. The modified Program P3_7 created by adding appropriate comment statements, and adding program statements for labeling each plot being generated by the program is given below: % Illustration of Circular Shift of a Sequence clf; M = 6; a = [0 1 2 3 4 5 6 7 8 9]; b = circshift(a,M); L = length(a)-1; n = 0:L; subplot(2,1,1); stem(n,a);axis([0,L,min(a),max(a)]); title('Original Sequence'); xlabel('n'); ylabel('Amplitude'); subplot(2,1,2); stem(n,b);axis([0,L,min(a),max(a)]); title(['Sequence Obtained by Circularly Shifting by ',num2str(M),' Samples']); xlabel('n'); ylabel('Amplitude'); The parameter determining the amount of time-shifting is M If the amount of time-shift is greater than the sequence length then the amount of time-shifting is modulus after M divide the length of a sequence - a. Q3.31 The plots generated by running the modified program are given below:
Original Sequence 8 Amplitude 6 4 2 0 0 1 5 6 7 8 n Sequence Obtained by Circularly Shifting by 6 Samples 2 3 4 9

Q3.28 Q3.29

Q3.30

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

From these plots we make the following observations: with M>0, we have a new, which is delayed.

15

Q3.32

The modified Program P3_8 created by adding appropriate comment statements, and adding program statements for labeling each plot being generated by the program is given below: % Circular Time-Shifting Property of DFT clf; x = [0 2 4 6 8 10 12 14 16]; N = length(x)-1; n = 0:N; y = circshift(x,5); XF = fft(x); YF = fft(y); subplot(2,2,1) stem(n,abs(XF));grid xlabel('n'); ylabel('Amplitude'); title('Magnitude of DFT of Original Seq'); subplot(2,2,2) stem(n,abs(YF));grid xlabel('n'); ylabel('Amplitude'); title('Magnitude of DFT of Circularly Shifted Seq'); subplot(2,2,3) stem(n,angle(XF));grid xlabel('n'); ylabel('Amplitude'); title('Phase of DFT of Original Seq'); subplot(2,2,4) stem(n,angle(YF));grid xlabel('n'); ylabel('Amplitude'); title('Phase of DFT of Circularly Shifted Seq');

The amount of time-shift is 5 sample. Q3.33 The plots generated by running the modified program are given below:
Magnitude of DFT of Original Seq 80 60 Amplitude 40 20 0 Amplitude 0 4 6 8 n Phase of DFT of Original Seq 2 Magnitude of DFT of Circularly Shifted Seq 80 60 40 20 0

4 2 Amplitude 0 -2 -4 Amplitude

4 6 8 n Phase of DFT of Circularly Shifted Seq 4 2 0 -2 -4

4 n

4 n

From these plots we make the following observations: Circular Time-Shifting Property of DFT only change about Phase. Q3.34 The plots generated by running the modified program for the following two different amounts of time-shifts, with the amount of shift indicated, are shown below:

16

The amount of time-shift is 10 sample


Magnitude of DFT of Original Seq 80 60 Amplitude 40 20 0 Amplitude 0 4 6 8 n Phase of DFT of Original Seq 2 Magnitude of DFT of Circularly Shifted Seq 80 60 40 20 0

4 2 0 -2 -4 Amplitude Amplitude

4 6 8 n Phase of DFT of Circularly Shifted Seq 4 2 0 -2 -4

4 n

4 n

The amount of time-shift is 20 sample


Magnitude of DFT of Original Seq 80 60 40 20 0 Amplitude 0 4 6 8 n Phase of DFT of Original Seq 2 Amplitude Magnitude of DFT of Circularly Shifted Seq 80 60 40 20 0

4 2 Amplitude 0 -2 -4 Amplitude

4 6 8 n Phase of DFT of Circularly Shifted Seq 4 2 0 -2 -4

4 n

4 n

From these plots we make the following observations: The Circular Time-Shifting Property is certain. Q3.35 The plots generated by running the modified program for the following two different sequences of different lengths, with the lengths indicated, are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: Q3.36 A copy of Program P3_9 is given below along with the plots generated by running this program:

17

% Program P3_9 % Circular Convolution Property of DFT g1 = [1 2 3 4 5 6]; g2 = [1 -2 3 3 -2 1]; n=1:length(g1); ycir = circonv(g1,g2); disp('Result of circular convolution = ');disp(ycir) subplot(2,1,1) stem(n,ycir);grid xlabel('n'); ylabel('Amplitude'); title('Result of circular convolution'); G1 = fft(g1); G2 = fft(g2); yc = real(ifft(G1.*G2)); disp('Result of IDFT of the DFT products = ');disp(yc) subplot(2,1,2) stem(n,real(yc)); xlabel('n'); ylabel('Amplitude'); title('Result of IDFT of the DFT products');

Rs lt o c c la c no tio e u f ir u r o v lu n 3 0 Amplitude

2 0

1 0

0 1

1 .5

3 .5 4 n Rs lt o ID To th D Tpo u ts eu f F f e F r dc

2 .5

4 .5

5 .5

3 0 Amplitude

2 0

1 0

0 1

1 .5

2 .5

3 .5 n

4 .5

5 .5

From these plots we make the following observations: circular convolution and IDFT of the DFT products give the same result. Q3.37 Program P3_9 was run again for the following two different sets of equal-length sequences: The plots generated are shown below: g1 = [1 2 3 4 5 6 7 8 9 10]; g2 = [1 -2 3 4 7 3 1 3 -2 1];
R l oicaooi n e t fc u c v t s u r l r nl o u 2 0 0 A p m litu e d 1 5 0 1 0 0 5 0 0 1

4 5 n R l o F fteF rdt e t fI T hDp us s Do u Toc

1 0

2 0 0 A p m litu e d 1 5 0 1 0 0 5 0 0 1

5 n

1 0

g1 = [1 2 3 4 5 6 7 8 9 10 7 4 6 2 5]; g2 = [1 -2 3 4 5 4 2 7 3 1 3 -2 1 0 5];

18

Result of circular convolution 250 200 Amplitude 150 100 50 0 0 10 n Result of IDFT of the DFT products 5 15

300

Amplitude

200

100

5 n

10

15

From these plots we make the following observations: circular convolution and IDFT of the DFT products give same result that is certain. Q3.38 A copy of Program P3_10 is given below along with the plots generated by running this program: % Linear Convolution via Circular Convolution g1 = [1 2 3 4 5];g2 = [2 2 0 1 1]; g1e = [g1 zeros(1,length(g2)-1)]; g2e = [g2 zeros(1,length(g1)-1)]; n=0:length(g1e)-1; ylin = circonv(g1e,g2e); disp('Linear convolution via circular convolution = ');disp(ylin); subplot(2,1,1) stem(n,ylin); xlabel('n'); ylabel('Amplitude'); title('Linear convolution via circular convolution'); y = conv(g1, g2); disp('Direct linear convolution = ');disp(y) subplot(2,1,2) stem(n,y); xlabel('n'); ylabel('Amplitude'); title('Direct linear convolution');

L e r c no tio v c c la c no tio in a o v lu n ia ir u r o v lu n 2 5 Amplitude 2 0 1 5 1 0 5 0 0 1 2 4 n De t lin a c no tio ir c e r o v lu n 3 5 6 7 8

3 0 Amplitude

2 0

1 0

0 0

4 n

From these plots we make the following observations: Linear convolution via circular convolution and Direct linear convolution give the same result.

19

Q3.39

Program P3_10 was run again for the following two different sets of sequences of unequal lengths: The plots generated are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations:

Q3.40

The MATLAB program to develop the linear convolution of two sequences via the DFT of each is given below: < Insert program code here. Copy from m-file(s) and paste. > The plots generated by running this program for the sequences of Q3.38 are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: The plots generated by running this program for the sequences of Q3.39 are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations:

Q3.41

A copy of Program P3_11 is given below: % Relations between the DFTs of the Periodic Even % and Odd Parts of a Real Sequence x = [1 2 4 2 6 32 6 4 2 zeros(1,247)]; x1 = [x(1) x(256:-1:2)]; xe = 0.5 *(x + x1); XF = fft(x); XEF = fft(xe); clf; k = 0:255; subplot(2,2,1); plot(k/128,real(XF)); grid; ylabel('Amplitude'); title('Re(DFT\{x[n]\})'); subplot(2,2,2); plot(k/128,imag(XF)); grid; ylabel('Amplitude'); title('Im(DFT\{x[n]\})'); subplot(2,2,3); plot(k/128,real(XEF)); grid; xlabel('Time index n');ylabel('Amplitude'); title('Re(DFT\{x_{e}[n]\})'); subplot(2,2,4); plot(k/128,imag(XEF)); grid; xlabel('Time index n');ylabel('Amplitude'); title('Im(DFT\{x_{e}[n]\})');

The relation between the sequence x1[n] and x[n] is mirror image each orther. Q3.42 The plots generated by running Program P3_11 are given below:

20

Re(DFT{x[n]}) 100 50 100 50 Amplitude 0 -50 -100

Im(DFT{x[n]})

Amplitude

-50

0.5

1
e

1.5

0 x 10

0.5
-14

1
e

1.5

Re(DFT{x [n]}) 100 50 0.5 Amplitude 0 -0.5

Im(DFT{x [n]})

Amplitude

-50

0.5 1 1.5 Time index n

0.5 1 1.5 Time index n

The imaginary part of XEF is/is not equal to zero. This result can be explained as follows: Q3.43 The required modifications to Program P3_11 to verify the relation between the DFT of the periodic odd part and the imaginary part of XEF are given below along with the plots generated by running this program: < Insert program code here. Copy from m-file(s) and paste. > < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations: Q3.44 A copy of Program P3_12 is given below: % Parseval's Relation x = [(1:128) (128:-1:1)]; XF = fft(x); a = sum(x.*x) b = round(sum(abs(XF).^2)/256) disp('a=');disp(a); disp('b=');disp(b); The values for a and b we get by running this program are: a=1414528 ; b=1414528 Q3.45 The required modifications to Program P3_11 are given below: % Parseval's Relation x = [(1:128) (128:-1:1)]; XF = fft(x); a = sum(x.*x) XFconj=conj(XF); b=round(sum(XF.*XFconj)/256); disp('a=');disp(a); disp('b=');disp(b); 3.3 z-TRANSFORM Analysis of z-Transforms

Project 3.5 Answers: Q3.46

The frequency response of the z-transform obtained using Program P3_1 is plotted below:

21

Q3.47

The MATLAB program to compute and display the poles and zeros, to compute and display the factored form, and to generate the pole-zero plot of a rational z-transform is given below: num = [2 5 9 5 3];den = [5 45 2 1 1]; zplane(num, den);grid; title('The pole-zero plot of a rational z-transform G(z)'); [z, p, k] = tf2zp(num,den); sos=(zp2sos(z,p,k)); disp(sos);

Using this program we obtain the following results on the z-transform G(z) of Q3.46:

22

Sos=

[0.4000 1.0000

0.8000 0.5000

1.2000 0.5000

1.0000

9.2293

2.4344; 0.0822]

1.0000 -0.2293

Q3.48

From the pole-zero plot generated in Question Q3.47, the number of regions of convergence (ROC) of G(z) are |z|>max|pi|=8.9576 All possible ROCs of this z-transform are sketched below: From the pole-zero plot it can be seen that the DTFT doesnt exist because the ROC of G(z) doesnt include the unit circle.

Q3.49

The MATLAB program to compute and display the rational z-transform from its zeros, poles and gain constant is given below: r = [0.3; 2.5; -0.2+0.4i; -0.2-0.4i]; p = [0.5; -0.75; 0.6+0.7i; 0.6-0.7i]; k =3.9; [num,den] = zp2tf(r,p,k); disp('num='),disp(num); disp('den='),disp(den);

The rational form of a z-transform with the given poles, zeros, and gain is found to be:

4 9.3 z 1 0.66 z 2 z 3 0.59 z 4 G( z ) = 1 0.95 z 1 + 0.18 z 2 + 0.66 z 3 0.32 z 4


Project 3.6 Answers: L=input('Input the samples of the inversetransform: L= '); num = [2 5 9 5 3];den = [5 45 2 1 1]; Inverse z-Transform

23

stem(impz(num,den,L)); title(['The inverse transform with Samples with ',num2str(L),' Samples']) xlabel('Time ') Q3.50 The MATLAB program to compute the first L samples of the inverse of a rational z-transform is given below: The plot of the first 50 samples of the inverse of G(z) of Q3.46 obtained using this program is sketched below:

Q3.51

The MATLAB program to determine the partial-fraction expansion of a rational z-transform is given below: num = [2 5 9 5 3]; den = [5 45 2 1 1]; [r,p,k]=residuez(num,den); disp('r='),disp(r); disp('p='),disp(p); disp('k='),disp(k);

The partial-fraction expansion of G(z) of Q3.46 obtained using this program is shown below: r= 0.3109 -1.0254 - 0.3547i -1.0254 + 0.3547i -0.8601 p= -8.9576 0.1147 + 0.2627i 0.1147 - 0.2627i -0.2718 k= 3.0000 From the above partial-fraction expansion we arrive at the inverse z-transform g[n] as shown below:

G( z) =

0.31 1.03 0.35 i 1.03 + 0.35 i 0.86 + + + +3 1 2 3 1 ( 8.96 ) z 1 (0.11 + 0.26 i ) z 1 (0.11 0.26 i ) z 1 ( 0.27 ) z 4

24

25