1、Name: Yifan Chen 20112121006 Section: Laboratory Exercise 3 DISCRETE-TIME SIGNALS: FREQUENCY-DOMAIN REPRESENTATIONS 3.1 DISCRETE-TIME FOURIER TRANSFORM Project 3.1 DTFT Computation A copy of Program P3_1 is given below: < Insert program code here. Copy from m-file(s) and paste. > % Pr
2、ogram P3_1 % Evaluation of the DTFT 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,1,1) plot(w/pi,real(h));grid title('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Am
3、plitude'); subplot(2,1,2) plot(w/pi,imag(h));grid title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); pause 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) plo
4、t(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); Answers: Q3.1 The expression of the DTFT being evaluated in Program P3_1 is - The function of the pause command is - causes M-files to stop and wait for you to press any key before continuing. Q3.2
5、 The plots generated by running Program P3_1 are shown below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > The DTFT is a period function of w. Its period is - 2 pi The types of symmetries exhibited by the four plots are as follows: Real part of H(e^{j\ome
6、ga}) is eve symmetries; Imaginary part of H(e^{j\omega}) is ode symmetries; Magnitude Spectrum |H(e^{j\omega})| is eve symmetries; Phase Spectrum arg[H(e^{j\omega})] is ode symmetries; Q3.3 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.3 are given below: < I
7、nsert program code here. Copy from m-file(s) and paste. > % Program Q3_3 % Evaluation of the DTFT clf; % 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,1,1) plot(w/pi,real(h));gr
8、id title('Real part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,1,2) plot(w/pi,imag(h));grid title('Imaginary part of H(e^{j\omega})') xlabel('\omega /\pi'); ylabel('Amplitude'); pause subplot(2,1,1) plot(w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\o
9、mega})|') 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, radians'); The plots generated by running the modified Program P3_1 are shown below: < Insert MATLAB figure(s
10、) here. Copy from figure window(s) and paste. > The DTFT is a perio function of w. Its period is – 2pi The jump in the phase spectrum is caused by - the real parts saltus step,the phase saltus set up. The phase spectrum evaluated with the jump removed by the command unwrap is
11、as given below: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > % Program Q3_3 % Evaluation of the DTFT clf; % 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); subplot(2,1,1) plot
12、w/pi,abs(h));grid title('Magnitude Spectrum |H(e^{j\omega})|') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,1,2) p = angle(h(:)); plot(w/pi,unwrap(p));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi'); ylabel('Phase, radians'); Q3.5 The required mo
13、difications to Program P3_1 to plot the phase in degrees are indicated below: < Insert program code here. Copy from m-file(s) and paste. > clf w=-4*pi:8*pi/511:4*pi; num=[2 1];den=[1 -0.6]; h=freqz(num,den,w); subplot(2,1,1) plot(w,real(h));grid; title('H(e^{j\angle}的实部') xlabel('\angle
14、'); ylabel('振幅'); subplot(2,1,2) plot(w/pi,imag(h)); grid title('H(e^{j\angle}的虚部') xlabel('\angle/'); ylabel('振幅'); figure(2); subplot(2,1,1) plot(w,abs(h));grid title('|H(e^{j\angle})|幅度谱') xlabel('\angle/'); ylabel('振幅'); subplot(2,1,2) plot(w,angle(h));grid title('相位谱arg[H(e^{j\a
15、ngle})]') xlabel('angle'); ylabel('以角度为单位的相位'); ct 3.2 DTFT Properties Answers: Q3.6 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: < Insert
16、program code here. Copy from m-file(s) and paste. > % 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 S
17、pectrum of Original Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,abs(h2));grid title('Magnitude Spectrum of Time-Shifted Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,angle(h1));grid title('Phase Spectrum of Original Sequ
18、ence') xlabel('\omega /\pi'); ylabel('Phase, radians'); subplot(2,2,4) plot(w/pi,angle(h2));grid title('Phase Spectrum of Time-Shifted Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); The parameter controlling the amount of time-shift is - D=10,[zeros(1,D) num] Q3.7 The plots
19、generated by running the modified program are given below: < Insert MATLABfigure(s) here. Copy from figure window(s) and paste. > figure(s) here. Copy from figure window(s) and paste. > From these plots we make the following observations:In the limited length of vector, in the original se
20、quence for discrete time Fourier transform, amplitude and phase is changed. From the continuous time, continuous frequency, is a continuous time, discrete frequency. Q3.10 The modified Program P3_3 created by adding appropriate comment statements, and adding program statements for labeling the
21、 two axes of each plot being generated by the program is given below: < Insert program code here. Copy from m-file(s) and paste. > % Program P3_3 % Time-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,
22、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 title('Magnitude Spectrum of Original Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,abs(h2));grid title('Magnitude Spectrum of Time-Shifted Sequence')
23、 xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,angle(h1));grid title('Phase Spectrum of Original Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); subplot(2,2,4) plot(w/pi,angle(h2));grid title('Phase Spectrum of Time-Shifted Sequence') xlabel('\omega /\pi'
24、); ylabel('Phase, radians'); The parameter controlling the amount of frequency-shift is -wo 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: < Insert MATLAB figure(s) here. Copy from figur
25、e window(s) and paste. > clf; w = -pi:2*pi/255:pi; wo = 3*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 title('Magnitude Spectrum of Original Sequence') xlabe
26、l('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,abs(h2));grid title('Magnitude Spectrum of Time-Shifted Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,angle(h1));grid title('Phase Spectrum of Original Sequence') xlabel('\omega /\pi'); ylabe
27、l('Phase, radians'); subplot(2,2,4) plot(w/pi,angle(h2));grid title('Phase Spectrum of Time-Shifted Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); From these plots we make the following observations:Select different values of frequency shift, can get different results. Q3.
28、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: < Insert program code here. Copy from m-file(s) and paste. > % Program P3_4 % Convolution Prope
29、rty 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('P
30、roduct of 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('Phase, radians'); subplot(2,2,4
31、) plot(w/pi,angle(h3));grid title('Phase Spectrum of Convolved Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); 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 generate
32、d by the program is given below: < Insert program code here. Copy from m-file(s) and paste. > % 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 = fr
33、eqz(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) pl
34、ot(w/pi,abs(h3));grid title('Magnitude Spectrum of Product Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); 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 progr
35、am is given below: < Insert program code here. Copy from m-file(s) and paste. > % Program P3_6 % 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); h2 = freqz(fliplr(num), 1, w); h3 = exp(w*L*i).*h2; subplot(2,2,1) plot(w
36、/pi,abs(h1));grid title('Magnitude Spectrum of Original Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,abs(h3));grid title('Magnitude Spectrum of Time-Reversed Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,angle(h1));grid
37、title('Phase Spectrum of Original Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); subplot(2,2,4) plot(w/pi,angle(h3));grid title('Phase Spectrum of Time-Reversed Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); The program implements the time-reversal operation a
38、s follows - From these plots we make the following observations: First of all, using the reverse function will row vector of molecular coefficient inversion, that is, from the original [1, 2, 3, 4] gone bad now [4 3 2 1], and then after the coefficient inversion sequence multiplied by the exp (L
39、 * w * I), make all the original molecules exp (- w * I) into the exp (w * I), so the x (n), thus to realize the flip operation time 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 b
40、elow: < Insert MATLAB figure(s) here. Copy from figure window(s) and paste. > clf; w = -pi:2*pi/255:pi; num=[1 3 6 9]; L = length(num)-1; h1 = freqz(num, 1, w); h2 = freqz(fliplr(num), 1, w); h3 = exp(w*L*i).*h2; subplot(2,2,1) plot(w/pi,abs(h1));grid title('Magnitude Spectrum of Orig
41、inal Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,2) plot(w/pi,abs(h3));grid title('Magnitude Spectrum of Time-Reversed Sequence') xlabel('\omega /\pi'); ylabel('Amplitude'); subplot(2,2,3) plot(w/pi,angle(h1));grid title('Phase Spectrum of Original Sequence') xlabel
42、'\omega /\pi'); ylabel('Phase, radians'); subplot(2,2,4) plot(w/pi,angle(h3));grid title('Phase Spectrum of Time-Reversed Sequence') xlabel('\omega /\pi'); ylabel('Phase, radians'); From these plots we make the following observations: Choose the different sequence length, can get different results.






