HOÀNG MINH PHÚC TRẦN THANH HÙNG

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:

1

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

4

-2

0

2

4

ω /π
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

4

-2

0

2

4

ω /π

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:

2

real(h)). den.grid 3 .5 Amplitude 0 -0.5 ω /π 1 0 0. w). h = freqz(num. ylabel('Amplitude'). The phase spectrum evaluated with the jump removed by the command unwrap is as given below: Q3.1) plot(w/pi.2) plot(w/pi. subplot(2.5 -1 Amplitude 1 0.5 Phase Spectrum arg[H(ejω)] 1 ω /π 1 4 2 0 -2 -4 Amplitude 1 1 1 0 0.4 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.imag(h)).2. The jump in the phase spectrum is caused by .den = 1.5 0 -0.5 1 ω /π Magnitude Spectrum |H(ejω)| Phase in radians 0 0.1 w. % Plot the DTFT subplot(2.5 1 ω /π The DTFT is a periodic function of Its period is .grid title('Real part of H(e^{j\omega})') xlabel('\omega /\pi').4 are given below: % Compute the frequency samples of the DTFT w = -4*pi:8*pi/511:4*pi.Real part of H(ejω ) 1 0.2.The jump in the phase spectrum is caused by an artifact of the arctangent function inside angle that signify zeros in the frequency response.5 -1 Imaginary part of H(ejω) 0 0. num = [1 3 5 7 9 11 13 15 17].

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. Project 3.grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'). ylabel('Phase in degrees'). Its period is .2.3) plot(w/pi.2.angle(h)*180/pi).grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'). ylabel('Amplitude').5 The required modifications to Program P3_1 to plot the phase in degrees are indicated below: plot(w/pi. subplot(2.angle(h)).2 Answers: Q3.grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'). ylabel('Phase in radians').title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'). 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 4 .4) plot(w/pi.abs(h)). 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 0 -50 -4 0 2 4 ω /π Magnitude Spectrum |H(ejω)| -2 -2 0 2 4 Phase Spectrum arg[H(ejω )] 4 Phase in radians 2 0 -2 -4 -4 ω /π 100 Amplitude 50 0 -4 -2 0 ω /π 2 4 -2 0 ω /π 2 4 The DTFT is a periodic function of w.6 DTFT Properties The modified Program P3_2 created by adding appropriate comment statements. subplot(2. Q3. ylabel('Amplitude').

h1 = freqz(num. Q3.5 1 Phase Spectrum of Original Sequence Phase Spectrum of Time-Shifted Sequence 4 4 2 0 -2 -4 -1 2 0 -2 -4 -1 -0. wo = 0. 1.8 Program P3_2 was run for the following value of the time-shift .5 1 -0.grid title('Phase Spectrum of Time-Shifted Sequence') The parameter controlling the amount of time-shift is – w = -pi:2*pi/255:pi.5 0 0.2) plot(w/pi. 1.5 The plots generated by running the modified program are given below: 5 . h2 = freqz([zeros(1.abs(h2)). w = -pi:2*pi/255:pi.5 1 0 -1 -0. w). D = 10.2. num = [1 2 3 4 5 6 7 8 9].3) plot(w/pi. w).5 0 0.4*pi.1) plot(w/pi.grid title('Magnitude Spectrum of Original Sequence') subplot(2.abs(h1)). D = 10. h1 = freqz(num.5 1 From these plots we make the following observations: magnitude spectrum is not changed and phase spectrum is changed.4*pi. 1.D) num].5 0 0.grid title('Phase Spectrum of Original Sequence') subplot(2.angle(h2)). Q3.grid title('Magnitude Spectrum of Time-Shifted Sequence') subplot(2.2. h2 = freqz([zeros(1.angle(h1)). 1. w).5 0 0. subplot(2.4) plot(w/pi.D) num]. w).2.clf.2.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. num = [1 2 3 4 5 6 7 8 9]. wo = 0.

and phase spectrum is is changed more.D = 15.5 1 0 -1 -0.5 0 0.5 1 -0.9 Program P3_2 was run for the following values of the time-shift and for the following values of length for the sequence . 6 .5 0 0.5 1 -0.5 1 0 -1 -0. 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.10 The modified Program P3_3 created by adding appropriate comment statements.5 0 0. Q3. From these plots we make the following observations: Q3.5 0 0.5 0 0.5 0 0. magnitude spectrum is not changed and phase spectrum is changed.Magnitude Spectrum of Original Sequence Magnitude Spectrum of Time-Shifted Sequence 60 60 40 40 20 20 0 -1 -0.5 1 From these plots we make the following observations: for two different sequences of varying lengths and two different time-shifts.5 0 0. 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.5 1 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 1 From these plots we make the following observations: when the time-shift is more greater.5 1 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 0.

2. title('Magnitude Spectrum of Frequency-Shifted Seq') subplot(2.5 1 ω /π Phase Spectrum of Frequency-Shifted Seq 4 2 Amplitude 0 -2 -4 -1 4 2 Amplitude 0 -2 -4 -1 -0. num1 = [1 3 5 7 9 11 13 15 17].1) plot(w/pi.2) plot(w/pi.grid xlabel('\omega /\pi'). title('Phase Spectrum of Original Seq') subplot(2.wo Q3.5 0 ω /π 0. L = length(num1).2. ylabel('Amplitude').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. 1.5 50 0 -1 0 -1 -0. The delay is 0. n = 0:L-1. num2 = exp(wo*i*n). ylabel('Amplitude'). title('Magnitude Spectrum of Original Seq') subplot(2.grid xlabel('\omega /\pi').*num1.5 1 ω /π From these plots we make the following observations: both magnitude spectrum and phase spectrum is shifted.abs(h2)).angle(h2)).abs(h1)). wo = 0. subplot(2. ylabel('Amplitude'). 1. title('Phase Spectrum of Frequency-Shifted Seq') The parameter controlling the amount of frequency-shift is .4*pi.5 1 ω /π Phase Spectrum of Original Seq -0.angle(h1)).3) plot(w/pi.2.12 Program P3_3 was run for the following value of the frequency-shift - 7 .2. h1 = freqz(num1.5 1 -0. ylabel('Amplitude'). w). Q3.4*pi.grid xlabel('\omega /\pi').grid xlabel('\omega /\pi').5 0 0. h2 = freqz(num2. w).5 0 0.w = -pi:2*pi/255:pi.4) plot(w/pi.

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.8*pi. the shift is more than. 1.14 The modified Program P3_4 created by adding appropriate comment statements.5 50 0 -1 0 -1 -0. Q3. h1 = freqz(x1.5 0 0.13 Program P3_3 was run for the following values of the frequency-shift and for the following values of length for the sequence .5 1 ω /π Phase Spectrum of Frequency-Shifted Seq 2 1 Amplitude 0 -1 -2 -1 2 1 Amplitude 0 -1 -2 -1 -0. w).wo=0.5 1 -0.5 1 ω /π From these plots we make the following observations:with the change above isn’t change Frequency-Shifting Property.x2). 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 0 0.5 1 ω /π Phase Spectrum of Original Seq -0. x1 = [1 3 5 7 9 11 13 15 17]. w = -pi:2*pi/255:pi.5 0 ω /π 0. x2 = [1 -2 3 -2 1]. 8 . Q3. y = conv(x1. 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.

grid title('Magnitude Spectrum of Convolved Sequence').abs(h3)). h3 = freqz(y.grid title('Sum of Phase Spectra'). ylabel('amplitude').angle(hp)). subplot(2. xlabel('\omega/\pi').2. 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 .2.w).grid title('Product of Magnitude Spectra'). 1. The plots generated by running the modified program are given below: 9 .2.*h2. xlabel('\omega/\pi').1) plot(w/pi. Q3. xlabel('\omega/\pi').3) plot(w/pi.2.h2 = freqz(x2.2) plot(w/pi.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 -. 5 1 -.4) plot(w/pi. ylabel('amplitude').1. 0 5 0 . 5 1 From these plots we make the following observations: with two way to compute give the same result.abs(hp)). 5 1 -. ylabel('amplitude').grid title('Phase Spectrum of Convolved Sequence'). hp = h1. 0 5 0 / ωπ 0 . Q3. subplot(2. subplot(2. subplot(2. x2 = [1 -2 3 ]. xlabel('\omega/\pi').16 Program P3_4 was run for the following two different sets of sequences of varying lengths x1 = [1 3 5 7 9 11 ]. w). 0 5 0 / ωπ 0 . 5 1 4 a p m litu e d 2 0 2 4 1 a p m litu e d -.angle(h3)). ylabel('amplitude').

1. w). 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.2) plot(w/pi.1.3) plot(w/pi.18 The plots generated by running the modified program are given below: 10 .17 The modified Program P3_5 created by adding appropriate comment statements. ylabel('amplitude').5 ω/ π Sum of Phase Spectra -0.w). w = -pi:2*pi/255:pi. x2 = [1 -1 1 -1 1 -1 1 -1 1]. xlabel('\omega/\pi').5 1 -0.1.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 1 ω/ π Phase Spectrum of Convolved Sequence 4 2 amplitude 0 -2 -4 -1 4 2 amplitude 0 -2 -4 -1 -0. h2 = freqz(x2.5 0 ω/ π 0.grid title('Magnitude Spectrum of Product Sequence'). subplot(3. ylabel('amplitude').5 0 0. 1.grid title('Magnitude Spectrum of First Sequence'). xlabel('\omega/\pi'). Q3.1. h1 = freqz(x1.5 0 0.1.abs(h1)). subplot(3.5 1 ω/ π From these plots we make the following observations: the above property is not change. subplot(3. x1 = [1 3 5 7 9 11 13 15 17]. h3 = freqz(y.abs(h3)).*x2.abs(h2)). Q3.5 1 -0. y = x1.1) plot(w/pi. w). xlabel('\omega/\pi').grid title('Magnitude Spectrum of Second Sequence'). ylabel('amplitude').

6 0.4 -0.2 0 0.4 -0.2 0 0. w).8 1 ω/ π Magnitude Spectrum of Second Sequence 20 amplitude 10 0 -1 -0.2 0 0.4 0.4 -0.4 -0.4 0. The plots generated by running the modified program are given below: Magnitude Spectrum of First Sequence 40 amplitude 20 0 -1 -0.2 0 0. 11 . x2 = [1 -2 3 5 7 3 ].4 0.2 0.4 0.2 0.4 -0.4 0.8 1 ω/ π Magnitude Spectrum of Product Sequence amplitude 200 100 0 -1 -0.2 0 ω/π 0.6 -0.Magnitude Spectrum of First Sequence 100 amplitude 50 0 -1 -0.2 0.6 -0.2 0 0.8 -0.6 0.6 0.19 Program P3_5 was run for the following two different sets of sequences of varying lengths x1 = [1 3 5 7 9 11 ].4 -0.2 0.6 0.8 -0.8 1 From these plots we make the following observations: Q3.8 -0.2 0.8 -0.6 -0. w = -pi:2*pi/255:pi.6 -0.8 1 ω/ π From these plots we make the following observations: Q3. 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.20 The modified Program P3_6 created by adding appropriate comment statements.8 1 ω/π Magnitude Spectrum of Product Sequence amplitude 100 50 0 -1 -0.6 -0.4 0.6 0. h1 = freqz(num.8 -0.6 -0.8 1 ω/π Magnitude Spectrum of Second Sequence 10 amplitude 5 0 -1 -0.6 0.8 -0. L = length(num)-1. num = [1 2 3 4].2 0. 1.

w). title('Magnitude Spectrum of Time-Reversed Seq') subplot(2. w).5 1 -0. Q3. title('Phase Spectrum of Time-Reversed Seq') The program implements the time-reversal operation as follows: h2 = freqz(fliplr(num). ylabel('amplitude').5 0 ω/ π 0.grid xlabel('\omega/\pi').1) plot(w/pi. subplot(2. 1.h2 = freqz(fliplr(num).5 0 0. ylabel('amplitude').2) plot(w/pi.grid xlabel('\omega/\pi').2.2. h3 = exp(w*L*i).5 Magnitude Spectrum of Time-Reversed Seq 10 8 6 4 2 -1 -0.2.5 1 ω/π From these plots we make the following observations both magnitude spectrum and phase spectrum is reverted in frequency domain. ylabel('amplitude'). title('Magnitude Spectrum of Original Seq') subplot(2.abs(h3)). 12 . 1.5 1 ω/π Phase Spectrum of Time-Reversed Seq 4 2 amplitude 0 -2 -4 -1 4 2 amplitude 0 -2 -4 -1 -0.3) plot(w/pi.2.*h2.abs(h1)).5 1 ω/ π Phase Spectrum of Original Seq -0. title('Phase Spectrum of Original Seq') subplot(2.angle(h1)).*h2.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]. Q3.4) plot(w/pi.grid xlabel('\omega/\pi').grid xlabel('\omega/\pi'). h3 = exp(w*L*i). ylabel('amplitude').5 0 0.angle(h3)).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.

0 5 0 .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 -.3 Answers: Q3. % Compute the frequency samples of the DFT xn = [1 3 5 7 9 11 13 15 17 2]. w=2*pi*k/N. 5 1 4 0 4 0 2 0 2 0 0 1 0 1 -.1. N=length(xn).xn). 5 1 P Sr oiiaq h puf rne a emgS s c Ol e t 4 P Sr o ev dq h pufi .2) ≥N 13 . -5 0 .den = 1. 0 / ω π 0 . 0 5 0 / ωπ 0 . ylabel('Amplitude'). -5 0 .1. %Plot the x[n]) subplot(3.1) stem(k. 0 / ω π 0 .2 DISCRETE FOURIER TRANSFORM DFT and IDFT Computations Project 3. 5 1 From these plots we make the following observations: the time-reversal property is not change 3. 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 .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 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 -. 5 1 4 a p m litu e d 2 0 2 4 1 a p m litu e d -.grid title('x[n]') xlabel('n').a pt d ml u e i 1 5 1 0 5 0 1 a pt d ml u e i 0 / ω π 0 . k=0:N-1. 5 1 a pt d ml u e i 2 0 2 4 1 a pt d ml u e i 0 / ω π 0 .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. % Plot the DFT subplot(3. den. 5 1 Mdpuf rne au emiiaq g e c ogS n Sr Ol i t t 2 0 Mdpufi ev dq au em . Xn = freqz(xn.e S a em Ree s c Te e t mr s 4 2 0 2 4 1 -5 0 . w). 5 1 num = [11 2 7 8 6 4 8]. 0 5 0 / ωπ 0 . 0 5 0 / ωπ 0 .

stem(w.4 DFT Properties 14 . subplot(3.grid title('Real part of X[n]') xlabel('w'). Copy from m-file(s) and paste. ylabel('Amplitude'). > From these plots we make the following observations: Project 3. Copy from m-file(s) and paste. > From these plots we make the following observations: Q3.grid title('Imaginary part of X[n]') xlabel('w'). Copy from figure window(s) and paste. Copy from figure window(s) and paste.imag(Xn)). Copy from figure window(s) and paste.1.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. > From these plots we make the following observations: Q3.3) stem(w.real(Xn)). > The DFTs generated by running the program for sequences of different lengths 2N are shown below: < Insert MATLAB figure(s) here. ylabel('Amplitude'). > The DFTs generated by running the program for sequences of different lengths N are shown below: < Insert MATLAB figure(s) here. 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.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.

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

3) stem(n. y = circshift(x. The amount of time-shift is 5 sample. subplot(2. with the amount of shift indicated.2.grid xlabel('n').34 The plots generated by running the modified program for the following two different amounts of time-shifts. ylabel('Amplitude'). title('Phase of DFT of Original Seq').Q3.abs(YF)). Q3.grid xlabel('n').abs(XF)). n = 0:N. N = length(x)-1. ylabel('Amplitude'). and adding program statements for labeling each plot being generated by the program is given below: % Circular Time-Shifting Property of DFT clf.angle(YF)). subplot(2. YF = fft(y).grid xlabel('n').grid xlabel('n'). ylabel('Amplitude'). subplot(2.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 0 2 0 2 4 n 6 8 0 2 4 n 6 8 From these plots we make the following observations: Circular Time-Shifting Property of DFT only change about Phase.2. ylabel('Amplitude').2) stem(n. title('Magnitude of DFT of Circularly Shifted Seq'). XF = fft(x).2. Q3. title('Phase of DFT of Circularly Shifted Seq').2.32 The modified Program P3_8 created by adding appropriate comment statements.4) stem(n. title('Magnitude of DFT of Original Seq').angle(XF)). subplot(2. x = [0 2 4 6 8 10 12 14 16].1) stem(n.5). are shown below: 16 .

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

disp('Result of IDFT of the DFT products = '). g2 = [1 -2 3 4 7 3 1 3 -2 1].ycir). disp('Result of circular convolution = ').5 4 n Rs lt o ID To th D Tpo u ts eu f F f e F r dc 2 . title('Result of circular convolution').5 3 4 .1) stem(n.disp(ycir) subplot(2. Q3.5 6 From these plots we make the following observations: circular convolution and IDFT of the DFT products give the same result. yc = real(ifft(G1. G2 = fft(g2).real(yc)).disp(yc) subplot(2. 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 3 .2) stem(n.5 5 5 .5 5 5 .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].5 6 3 0 Amplitude 2 0 1 0 0 1 1 . G1 = fft(g1). ycir = circonv(g1.% Program P3_9 % Circular Convolution Property of DFT g1 = [1 2 3 4 5 6].*G2)). 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 2 3 4 5 n R l o F fteF rdt e t fI T hDp us s Do u Toc 6 7 8 9 1 0 2 0 0 A p m litu e d 1 5 0 1 0 0 5 0 0 1 2 3 4 5 n 6 7 8 9 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].5 2 2 .1. 18 .g2).grid xlabel('n').5 n 4 4 .1. n=1:length(g1).5 2 3 . title('Result of IDFT of the DFT products'). g2 = [1 -2 3 3 -2 1]. ylabel('Amplitude'). xlabel('n'). ylabel('Amplitude').

xlabel('n').1.length(g2)-1)].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].length(g1)-1)]. title('Linear convolution via circular convolution').1.g2e).disp(y) subplot(2.y). n=0:length(g1e)-1. y = conv(g1.g2 = [2 2 0 1 1]. g2e = [g2 zeros(1. ylabel('Amplitude'). g1e = [g1 zeros(1.disp(ylin).ylin). subplot(2. 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 1 2 3 4 n 5 6 7 8 From these plots we make the following observations: Linear convolution via circular convolution and Direct linear convolution give the same result.2) stem(n. xlabel('n'). disp('Linear convolution via circular convolution = '). title('Direct linear convolution').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 0 0 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. g2). disp('Direct linear convolution = '). 19 .1) stem(n. ylin = circonv(g1e. Q3. ylabel('Amplitude').

imag(XF)).2. plot(k/128. k = 0:255. > From these plots we make the following observations: Q3. Copy from figure window(s) and paste.ylabel('Amplitude'). subplot(2. title('Im(DFT\{x_{e}[n]\})'). grid. plot(k/128. ylabel('Amplitude').5 *(x + x1).2). Q3. xlabel('Time index n').Q3. ylabel('Amplitude').2. > From these plots we make the following observations: Q3. > The plots generated by running this program for the sequences of Q3.3). Copy from figure window(s) and paste. XF = fft(x).ylabel('Amplitude').42 The plots generated by running Program P3_11 are given below: 20 . The relation between the sequence x1[n] and x[n] is mirror image each orther. xe = 0. xlabel('Time index n'). XEF = fft(xe). title('Re(DFT\{x_{e}[n]\})'). title('Im(DFT\{x[n]\})').39 are shown below: < Insert MATLAB figure(s) here.38 are shown below: < Insert MATLAB figure(s) here.real(XEF)). grid.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. > From these plots we make the following observations: The plots generated by running this program for the sequences of Q3. subplot(2. grid.2.1). Copy from figure window(s) and paste. x1 = [x(1) x(256:-1:2)].real(XF)).4). title('Re(DFT\{x[n]\})').2.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. plot(k/128.imag(XEF)). grid. subplot(2.247)]. plot(k/128. Copy from m-file(s) and paste. clf. subplot(2.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 figure window(s) and paste.5 Time index n 2 0 0. disp('b=').46 The frequency response of the z-transform obtained using Program P3_1 is plotted below: 21 .5 -14 1 e 1.*x) XFconj=conj(XF).*XFconj)/256). a = sum(x.^2)/256) disp('a=').5 Amplitude 0 -0.5 Answers: Q3.5 2 Re(DFT{x [n]}) 100 50 0.disp(a).disp(b).*x) b = round(sum(abs(XF). The values for a and b we get by running this program are: a=1414528 .45 The required modifications to Program P3_11 are given below: % Parseval's Relation x = [(1:128) (128:-1:1)]. XF = fft(x).3 z-TRANSFORM Analysis of z-Transforms Project 3.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.5 1 1. > < Insert MATLAB figure(s) here.5 2 0 x 10 0.44 A copy of Program P3_12 is given below: % Parseval's Relation x = [(1:128) (128:-1:1)]. disp('a=').disp(a). This result can be explained as follows: Q3. > From these plots we make the following observations: Q3. Copy from m-file(s) and paste.5 Im(DFT{x [n]}) Amplitude 0 -50 0 0.Re(DFT{x[n]}) 100 50 100 50 Amplitude 0 -50 -100 Im(DFT{x[n]}) Amplitude 0 -50 0 0. XF = fft(x).disp(b).5 Time index n 2 The imaginary part of XEF is/is not equal to zero.5 1 e 1. disp('b='). 3. b=round(sum(XF. a = sum(x. b=1414528 Q3.5 1 1.

46: 22 . [z. title('The pole-zero plot of a rational z-transform G(z)').p. zplane(num. k] = tf2zp(num.den = [5 45 2 1 1]. to compute and display the factored form. sos=(zp2sos(z. p. disp(sos).Q3. and to generate the pole-zero plot of a rational z-transform is given below: num = [2 5 9 5 3].den).47 The MATLAB program to compute and display the poles and zeros. den).k)). Using this program we obtain the following results on the z-transform G(z) of Q3.grid.

5.5. zeros.4i].2+0.0000 9.66 z −3 − 0.32 z −4 Project 3. num = [2 5 9 5 3].Sos= [0.9.2293 2. disp('num=').3.4i.95 z −1 + 0.75.6+0.den] = zp2tf(r.8000 0.49 The MATLAB program to compute and display the rational z-transform from its zeros.7i. -0. 0. poles and gain constant is given below: r = [0.6 Answers: L=input('Input the samples of the inversetransform: L= ').den = [5 45 2 1 1].5000 1.48 From the pole-zero plot generated in Question Q3.2293 Q3.0000 0.6-0. the number of regions of convergence (ROC) of G(z) are |z|>max|pi|=8. -0.59 z −4 G( z ) = 1 − 0.4344.2-0. k =3. 0.0822] 1.k).18 z −2 + 0.9576 All possible ROCs of this z-transform are sketched below: From the pole-zero plot it can be seen that the DTFT doesn’t exist because the ROC of G(z) doesn’t include the unit circle.4000 1.3 z −1 − 0. Inverse z-Transform 23 .2000 0. [num.p. 0. Q3.66 z −2 − z −3 − 0.5000 1. The rational form of a z-transform with the given poles.7i]. 2. p = [0. and gain is found to be: 4 − 9. disp('den='). -0.disp(num).47.disp(den).0000 -0.

27 ) z −4 24 .46 obtained using this program is sketched below: Q3.0254 + 0.3547i -0.26 i ) z 1 − ( −0.35 i −1.' Samples']) xlabel('Time ') Q3. den = [5 45 2 1 1].46 obtained using this program is shown below: r= 0.2627i -0.2627i 0.11 + 0.disp(p).0254 .L)).den.3109 -1.3547i -1.31 −1.disp(r).0.0.disp(k). disp('r=').1147 + 0. The partial-fraction expansion of G(z) of Q3.1147 .03 − 0.11 − 0.96 ) z 1 − (0. [r.26 i ) z 1 − (0.35 i − 0.num2str(L).86 + + + +3 − 1 −2 −3 1 − ( −8.k]=residuez(num.8601 p= -8. disp('p=').stem(impz(num.2718 k= 3.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.9576 0. title(['The inverse transform with Samples with '.03 + 0.51 The MATLAB program to determine the partial-fraction expansion of a rational z-transform is given below: num = [2 5 9 5 3]. disp('k=').den).p.0000 From the above partial-fraction expansion we arrive at the inverse z-transform g[n] as shown below: G( z) = 0.

25 .

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.