数字信号处理米特拉第四版实验四答案
数字信号处理米特拉第四版实验一答案
Name : SOLUTION Section :Laboratory Exercise 1DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION1.1GENERATION OF SEQUENCESProject 1.1Unit sample and unit step sequencesA copy of Program P1_1 is given below.% Program P1_1% Generation of a Unit Sample Sequence clf;% Generate a vector from -10 to 20 n = -10:20;% Generate the unit sample sequence u = [zeros(1,10) 1 zeros(1,20)]; % Plot the unit sample sequence stem(n,u);xlabel('Time index n');ylabel('Amplitude'); title('Unit Sample Sequence'); axis([-10 20 0 1.2]); Answers : Q1.1The unit sample sequence u[n] generated by running Program P1_1 is shown below:Time index nA m p l i t u d eUnit Sample SequenceQ1.2The purpose of clf command is – clear the current figureThe purpose of axis command is – control axis scaling and appearanceThe purpose of title command is – add a title to a graph or an axis and specify textpropertiesThe purpose of xlabel command is – add a label to the x-axis and specify textpropertiesThe purpose of ylabel command is – add a label to the y-axis and specify the textpropertiesQ1.3The modified Program P1_1 to generate a delayed unit sample sequence ud[n] with a delay of 11 samples is given below along with the sequence generated by running this program .% Program P1_1, MODIFIED for Q1.3% Generation of a DELAYED Unit Sample Sequence clf;% Generate a vector from -10 to 20 n = -10:20;% Generate the DELAYED unit sample sequence u = [zeros(1,21) 1 zeros(1,9)];% Plot the DELAYED unit sample sequence stem(n,u);xlabel('Time index n');ylabel('Amplitude'); title('DELAYED Unit Sample Sequence'); axis([-10 20 0 1.2]);Time index nA m p l i t u d eDELAYED Unit Sample SequenceQ1.4The modified Program P1_1 to generate a unit step sequence s[n] is given below along with the sequence generated by running this program .% Program Q1_4% Generation of a Unit Step Sequence clf;% Generate a vector from -10 to 20 n = -10:20;% Generate the unit step sequence s = [zeros(1,10) ones(1,21)]; % Plot the unit step sequence stem(n,s);xlabel('Time index n');ylabel('Amplitude'); title('Unit Step Sequence'); axis([-10 20 0 1.2]);Time index nA m p l i t u d eUnit Step SequenceQ1.5The modified Program P1_1 to generate a unit step sequence sd[n] with an advance of 7 samples is given below along with the sequence generated by running this program .% Program Q1_5% Generation of an ADVANCED Unit Step Sequence clf;% Generate a vector from -10 to 20 n = -10:20;% Generate the ADVANCED unit step sequence sd = [zeros(1,3) ones(1,28)];% Plot the ADVANCED unit step sequence stem(n,sd);xlabel('Time index n');ylabel('Amplitude'); title('ADVANCED Unit Step Sequence'); axis([-10 20 0 1.2]);Time index nA m p l i t u d eADVANCED Unit Step SequenceProject 1.2 Exponential signalsA copy of Programs P1_2 and P1_3 are given below .% Program P1_2% Generation of a complex exponential sequence clf;c = -(1/12)+(pi/6)*i; K = 2; n = 0:40;x = K*exp(c*n); subplot(2,1,1); stem(n,real(x));xlabel('Time index n');ylabel('Amplitude'); title('Real part'); subplot(2,1,2); stem(n,imag(x));xlabel('Time index n');ylabel('Amplitude'); title('Imaginary part');% Program P1_3% Generation of a real exponential sequence clf;n = 0:35; a = 1.2; K = 0.2; x = K*a.^n; stem(n,x);xlabel('Time index n');ylabel('Amplitude');Answers: Q1.6The complex-valued exponential sequence generated by running Program P1_2 is shown below :510152025303540Time index n A m p l i t u d eReal partTime index nA m p l i t u d eImaginary partQ1.7The parameter controlling the rate of growth or decay of this sequence is – the real part of c .The parameter controlling the amplitude of this sequence is - KQ1.8The result of changing the parameter c to (1/12)+(pi/6)*i is – since exp(-1/12) isless than one and exp(1/12) is greater than one, this change means that the envelope of the signal will grow with n instead of decay with n.Q1.9The purpose of the operator real is – to extract the real part of a Matlab vector.The purpose of the operator imag is – to extract the imaginary part of a Matlab vector. Q1.10The purpose of the command subplot is – to plot more than one graph in the sameMatlab figure.Q1.11The real-valued exponential sequence generated by running Program P1_3 is shown below :Time index nA m p l i t u d eQ1.12The parameter controlling the rate of growth or decay of this sequence is - aThe parameter controlling the amplitude of this sequence is - KQ1.13The difference between the arithmetic operators ^ and .^ is – “^” raises a square matrix toa power using matrix multiplication. “.^” raises the elements of a matrix or vector to a power; this is a “pointwise” operation.Q1.14The sequence generated by running Program P1_3 with the parameter a changed to 0.9 and the parameter K changed to 20 is shown below :5101520253035Time index nA m p l i t u d eQ1.15The length of this sequence is - 36It is controlled by the following MATLAB command line : n = 0:35;It can be changed to generate sequences with different lengths as follows (give an example command line and the corresponding length): n = 0:99; makes the length 100. Q1.16The energies of the real-valued exponential sequences x [n]generated in Q1.11 and Q1.14 and computed using the command sum are - 4.5673e+004 and 2.1042e+003.Project 1.3 Sinusoidal sequencesA copy of Program P1_4 is given below .% Program P1_4% Generation of a sinusoidal sequence n = 0:40;f = 0.1; phase = 0; A = 1.5; arg = 2*pi*f*n - phase; x = A*cos(arg);clf; % Clear old graphstem(n,x); % Plot the generated sequence axis([0 40 -2 2]); grid;title('Sinusoidal Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis; Answers:Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .0510152025303540Sinusoidal SequenceTime index nA m p l i t u d eQ1.18The frequency of this sequence is- f = 0.1 cycles/sample.It is controlled by the following MATLAB command line: f = 0.1;A sequence with new frequency 0.2 can be generated by the following command line:f = 0.2;The parameter controlling the phase of this sequence is- phaseThe parameter controlling the amplitude of this sequence is- AThe period of this sequence is - 2π/ω = 1/f = 10Q1.19 The length of this sequence is - 41It is controlled by the following MATLAB command line: n = 0:40;A sequence with new length __81_ can be generated by the following command line:n = 0:80;Q1.20 The average power of the generated sinusoidal sequence is–sum(x(1:10).*x(1:10))/10 = 1.1250Q1.21 The purpose of axis command is – to set the range of the x-axis to [0,40] and the range of the y-axis to [-2,2].The purpose of grid command is – to turn on the drawing of grid lines on the graph.Q1.22 The modified Program P1_4 to generate a sinusoidal sequence of frequency 0.9 is given below along with the sequence generated by running it.% Program Q1_22A% Generation of a sinusoidal sequencen = 0:40;f = 0.9;phase = 0;A = 1.5;arg = 2*pi*f*n - phase;x = A*cos(arg);clf; % Clear old graphstem(n,x); % Plot the generated sequenceaxis([0 40 -2 2]);grid;title('Sinusoidal Sequence');xlabel('Time index n');ylabel('Amplitude');axis;Sinusoidal SequenceTime index nA m p l i t u d eA comparison of this new sequence with the one generated in Question Q1.17 shows - thetwo graphs are identical. This is because, in the modified program, we have ω = 0.9*2π. This generates the same graph as a cosine with angular frequency ω - 2π = −0.1*2π. Because cosine is an even function, this is the same as a cosine with angular frequency +0.1*2π, which was the value used in P1_4.m in Q1.17.In terms of Hertzian frequency, we have for P1_4.m in Q1.17 that f = 0.1 Hz/sample. For the modified program in Q1.22, we have f = 0.9 Hz/sample, which generates the same graph as f = 0.9 – 1 = −0.1. Again because cosine is even, this makes a graph that is identical to the one we got in Q1.17 with f = +0.1 Hz/sample.A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is shown below.0510152025303540Sinusoidal SequenceTime index nA m p l i t u d eA comparison of this new sequence with the one generated in Question Q1.17 shows - thegraph here is again identical to the one in Q1.17. This is because a cosine of frequency f = 1.1 Hz/sample is identical to one with frequency f = 1.1 – 1 = 0.1 Hz/sample, which was the frequency used in Q1.17.Q1.23The sinusoidal sequence of length 50, frequency 0.08, amplitude 2.5, and phase shift of 90 degrees generated by modifying Program P1_4 is displayed below .NOTE: for this program, it is necessary to convert the phase of 90 deg to radians and account for the minus sign that appears in the statement “arg = 2*pi*f*n - phase;” as opposed to the plus sign shown in eq. (1.12) of the lab manual. The correct statement to generate the phase is “phase = -90/(2*pi);”. It is also necessary to modify the axis command to account for the new length and amplitude of the signal. The correct axis statement is “axis([0 50 -3 3]);”.05101520253035404550Sinusoidal SequenceTime index nA m p l i t u d eThe period of this sequence is - 2π/ω = 1/f = 1/0.08 = 1/(8/100) = 100/8 = 25/2.Therefore, the fundamental period is 25 and the graph has the “appearance” of going through 2 cycles of a cosine waveform during each period.Q1.24By replacing the stem command in Program P1_4 with the plot command, the plot obtained is as shown below :Sinusoidal SequenceTime index nA m p l i t u d eThe difference between the new plot and the one generated in Question Q1.17 is – instead ofdrawing stems from the x-axis to the points on the curve, the “plot ” command connects the points with straight line segments, which approximates the graph of a continuous-time cosine signal.Q1.25By replacing the stem command in Program P1_4 with the stairs command the plot obtained is as shown below :Sinusoidal SequenceTime index nA m p l i t u d eThe difference between the new plot and those generated in Questions Q1.17 and Q1.24 is– the “stairs” command produces a stairstep plot as opposed to the stem graph that was generated in Q1.17 and the straight-line interpolation plot that was generated in Q1.24.Project 1.4 Random signalsAnswers:Q1.26 The MATLAB program to generate and display a random signal of length 100 with elements uniformly distributed in the interval [–2, 2] is given below along with the plot of the random sequence generated by running the program:% Program Q1_26% Generation of a uniform random sequencen = 0:99;A = 2;rand('state',sum(100*clock)); % "seed" the generator% rand(1,100) is uniform in [0,1]% rand(1,100)-0.5 is uniform in [-0.5,0.5]% 4*(rand(1,100)-0.5) is uniform in [-2,2]x = 2*A*(rand(1,length(n))-0.5);clf; % Clear old graphstem(n,x); % Plot the generated sequenceaxis([0 length(n) -round(2*(A+0.5))/2 round(2*(A+0.5))/2]);grid;title('Uniform Random Sequence');xlabel('Time index n');ylabel('Amplitude');axis;102030405060708090100Uniform Random SequenceTime index nA m p l i t u d eQ1.27 The MATLAB program to generate and display a Gaussian random signal of length 75 withelements normally distributed with zero mean and a variance of 3 is given below along with the plot of the random sequence generated by running the program :% Program Q1_27% Generation of a Gaussian random sequence% NOTE: if X is a random variable with zero mean and % unity variance, then (aX + b) is a random variable % with mean b and variance a^2. This follows from % basic probability theory. n = 0:74;xmean = 0; % mean of xxstd = sqrt(3); % standard deviation of xrandn('state',sum(100*clock)); % "seed" the generator % generate the sequencex = xstd*randn(1,length(n)) + xmean; % setup the graph and plotclf; % Clear old graphstem(n,x); % Plot the generated sequence xmax = max(abs(x));Ylim = round(2*(xmax+0.5))/2; axis([0 length(n) -Ylim Ylim]); grid;title('Gaussian Random Sequence'); xlabel('Time index n'); ylabel('Amplitude'); axis;10203040506070Gaussian Random SequenceTime index nA m p l i t u d eQ1.28The MATLAB program to generate and display five sample sequences of a random sinusoidal signal of length 31{X[n]} = {A·cos(ωo n + φ)}where the amplitude A and the phase φ are statistically independent random variables with uniform probability distribution in the range 0≤A ≤4 for the amplitude and in the range 0 ≤ φ ≤ 2π for the phase is given below. Also shown are five sample sequences generated by running this program five different times .% Generates the "deterministic stochastic process" % called for in Q1.28. n = 0:30; f = 0.1; Amax = 4;phimax = 2*pi;rand('state',sum(100*clock)); % "seed" the generator A = Amax*rand;% NOTE: successive calls to rand without arguments % return a random sequence of scalars. Since this % random sequence is "white" (uncorrelated), it is % not necessary to re-seed the generator for phi. phi = phimax*rand;% generate the sequence arg = 2*pi*f*n + phi; x = A*cos(arg); % plotclf; % Clear old graphstem(n,x); % Plot the generated sequence Ylim = round(2*(Amax+0.5))/2; axis([0 length(n) -Ylim Ylim]); grid;title('Sinusoidal Sequence with Random Amplitude and Phase'); xlabel('Time index n'); ylabel('Amplitude'); axis;Sinusoidal Sequence with Random Amplitude and PhaseTime index nA m p l i t u d eSinusoidal Sequence with Random Amplitude and PhaseTime index nA m p l i t u d eTime index nA m p l i t u d eSinusoidal Sequence with Random Amplitude and PhaseTime index nA m p l i t u d eTime index nA m p l i t u d e1.2 SIMPLE OPERATIONS ON SEQUENCESProject 1.5Signal SmoothingA copy of Program P1_5 is given below .% Program P1_5% Signal Smoothing by Averaging clf; R = 51;d = 0.8*(rand(R,1) - 0.5); % Generate random noise m = 0:R-1;s = 2*m.*(0.9.^m); % Generate uncorrupted signal x = s + d'; % Generate noise corrupted signal subplot(2,1,1);plot(m,d','r-',m,s,'g--',m,x,'b-.');xlabel('Time index n');ylabel('Amplitude'); legend('d[n] ','s[n] ','x[n] ');x1 = [0 0 x];x2 = [0 x 0];x3 = [x 0 0]; y = (x1 + x2 + x3)/3; subplot(2,1,2);plot(m,y(2:R+1),'r-',m,s,'g--'); legend( 'y[n] ','s[n] ');xlabel('Time index n');ylabel('Amplitude'); Answers: Q1.29The signals generated by running Program P1_5 are displayed below :05101520253035404550-5510Time index nA m p l i t u d e2468Time index nA m p l i t u d eQ1.30The uncorrupted signal s[n]is - the product of a linear growth with a slowly decayingreal exponential.The additive noise d[n]is – a random sequence uniformly distributed between -0.4 and+0.4.Q1.31 The statement x = s + d CANNOT be used to generate the noise corrupted signalbecause – d is a column vector, whereas s is a row vector; it is necessary to transposeone of these vectors before adding them.Q1.32The relations between the signals x1, x2, and x3, and the signal x are – all three signalsx1, x2, and x3 are extended versions of x , with one additional sample appended at the left and one additional sample appended to the right. The signal x1 is a delayedversion of x , shifted one sample to the right with zero padding on the left. The signal x2 is equal to x , with equal zero padding on both the left and right to account for the extended length. Finally, x3 is a time advanced version of x , shifted one sample to the left with zero padding on the right.Q1.33The purpose of the legend command is – to create a legend for the graphs. In P1_5, the signals are plotted using different colors and line types; the legend providesinformation about which color and line type is associated with each signal.Project 1.6Generation of Complex SignalsA copy of Program P1_6 is given below.% Program P1_6% Generation of amplitude modulated sequenceclf;n = 0:100;m = 0.4;fH = 0.1; fL = 0.01;xH = sin(2*pi*fH*n);xL = sin(2*pi*fL*n);y = (1+m*xL).*xH;stem(n,y);grid;xlabel('Time index n');ylabel('Amplitude');Answers:Q1.34 The amplitude modulated signals y[n]generated by running Program P1_6 for various values of the frequencies of the carrier signal xH[n]and the modulating signal xL[n], andvarious values of the modulation index m are shown below:m=0.4; fH=0.1; fL=0.01:Time index nA m p l i t u d em=0.9; fH=0.1; fL=0.1:Time index nA m p l i t u d em=0.4; fH=0.1; fL=0.005:Time index nA m p l i t u d em=0.4; fH=0.25; fL=0.01:Time index nA m p l i t u d eQ1.35 The difference between the arithmetic operators * and .* is – “*” multiplies twoconformable matrices or vectors using matrix multiplication. “.*” takes the pointwise products of the elements of two matrices or vectors that have the same dimensions.A copy of Program P1_7 is given below .% Program P1_7% Generation of a swept frequency sinusoidal sequence n = 0:100; a = pi/2/100; b = 0;arg = a*n.*n + b*n; x = cos(arg);clf; stem(n, x);axis([0,100,-1.5,1.5]);title('Swept-Frequency Sinusoidal Signal'); xlabel('Time index n'); ylabel('Amplitude'); grid; axis; Answers:Q1.36 The swept-frequency sinusoidal sequence x[n] generated by running Program P1_7 isdisplayed below .Swept-Frequency Sinusoidal SignalTime index nA m p l i t u d eQ1.37The minimum and maximum frequencies of this signal are - The minimum occurs at n=0, where we have 2an+b = 0 rad/sample = 0 Hz/sample. The maximum occurs at n=100, where we have 2an+b = 200a = 200π(0.5)(0.01) = π rad/sample= 0.5 Hz/sample.Q1.38The Program 1_7 modified to generate a swept sinusoidal signal with a minimum frequency of0.1 and a maximum frequency of 0.3 is given below:Note: for a minimum frequency of 0.1 Hz/sample = π/5 rad/sample at n=0, we must have 2a(0) + b =π/5, which implies b=π/5. For a maximum frequency of 0.3 Hz/sample = 3π/5 rad/sample at n=100, we must have 2a(100) + π/5 = 3π/5, which implies a=π/500.% Program Q1_38% Generation of a swept frequency sinusoidal sequencen = 0:100;a = pi/500;b = pi/5;arg = a*n.*n + b*n;x = cos(arg);clf;stem(n, x);axis([0,100,-1.5,1.5]);title('Swept-Frequency Sinusoidal Signal');xlabel('Time index n');ylabel('Amplitude');grid; axis;INFORMATION1.3 WORKSPACEQ1.39The information displayed in the command window as a result of the who command is – a listing of the names of the variables defined in the current workspace.Q1.40The information displayed in the command window as a result of the whos command is – a long form listing of the variables defined in the current workspace, including the variable names, their dimensions (size), the number of bytes of storage required for each variable, and the datatype of each variable. The total number of bytes of storagefor the entire workspace is also displayed.1.4 OTHER TYPES OF SIGNALS (Optional)Project 1.8 Squarewave and Sawtooth SignalsAnswer:Q1.41MATLAB programs to generate the square-wave and the sawtooth wave sequences of the type shown in Figures 1.1 and 1.2 are given below along with the sequences generated by running these programs:% Program Q1_41A% Generation of the square wave in Fig. 1.1(a)n = 0:30;f = 0.1;phase = 0;duty=60;A = 2.5;arg = 2*pi*f*n + phase;x = A*square(arg,duty);clf; % Clear old graphstem(n,x); % Plot the generated sequenceaxis([0 30 -3 3]);grid;title('Square Wave Sequence of Fig. 1.1(a)');xlabel('Time index n');ylabel('Amplitude');axis;% Program Q1_41B% Generation of the square wave in Fig. 1.1(b)n = 0:30;f = 0.1;phase = 0;duty=30;A = 2.5;arg = 2*pi*f*n + phase;x = A*square(arg,duty);clf; % Clear old graphstem(n,x); % Plot the generated sequenceaxis([0 30 -3 3]);grid;title('Square Wave Sequence of Fig. 1.1(b)');xlabel('Time index n');ylabel('Amplitude');axis;% Program Q1_41C% Generation of the square wave in Fig. 1.2(a) n = 0:50;f = 0.05;phase = 0;peak = 1;A = 2.0;arg = 2*pi*f*n + phase;x = A*sawtooth(arg,peak);clf; % Clear old graphstem(n,x); % Plot the generated sequence axis([0 50 -2 2]);grid;title('Sawtooth Wave Sequence of Fig. 1.2(a)'); xlabel('Time index n');ylabel('Amplitude');axis;% Program Q1_41D% Generation of the square wave in Fig. 1.2(b) n = 0:50;f = 0.05;phase = 0;peak = 0.5;A = 2.0;arg = 2*pi*f*n + phase;x = A*sawtooth(arg,peak);clf; % Clear old graphstem(n,x); % Plot the generated sequence axis([0 50 -2 2]);grid;title('Sawtooth Wave Sequence of Fig. 1.2(b)'); xlabel('Time index n');ylabel('Amplitude');axis;051015202530Time index nA m p l i t u d eSquare Wave Sequence of Fig. 1.1(b)Time index nA m p l i t u d eTime index nA m p l i t u d eSawtooth Wave Sequence of Fig. 1.2(b)Time index nA m p l i t u d eDate: 14 September, 2006 Signature: HAVLICEK。
数字信号处理教程第四版答案
z2 x (n ) [z ]z 0 8 1 (z )z 4
当n 0时,围线内部没有极点 ,故x(n) 0
1 x(n) 7 u(n 1) 8(n) 4
n
z2 部分分式法: X(z) 1 z 4 X(z) z2 A1 A2 故 1 1 z z (z )z z 4 4
数 字 信 号 处 理
第二章 z变换与离散时间傅里叶 变换(DTFT)
2.2 z变换的定义与收敛域
序列x(ห้องสมุดไป่ตู้)的z变换定义为:
n x ( n ) z
X ( z)
n
对任意给定序列x(n),使其z变换收敛的所有z值的集合 称为X(z)的收敛域,上式收敛的充分必要条件是满足绝 对可和
1 z2 A1 [(z ) ] 1 7 1 4 (z )z z 4 4 z2 A 2 [z ] 8 1 z 0 (z )z 4
n
7 1 X( z ) 8,| z | 1 1 4 1 z 4
1 x(n) 7 u(n 1) 8(n) 4
1 | z | 4
n 1
jIm[z]
1/4 o
Re[z]
当n 1时,分母中z的阶次比分子中 z的阶次高两阶 或两阶以上,可用围线 外部极点求解
1 (z 2)z n 1 1 n x (n ) [(z ) ] 1 7( ) z 1 4 4 4 z 4
z2 当n 0时,F(z) ,此时围线内部有一阶 极点z 0 1 (z )z 4
1 n x (n ) ( ) u (n ) 2
部分分式法: Z[a n u (n )]
1 , | z || a | 1 1 az
数字信号处理—原理、实现及应用(第4版)第8章 时域离散系统的实现 学习要点及习题答案
·185·第8章 时域离散系统的实现本章学习要点第8章研究数字信号处理系统的实现方法。
数字信号处理系统设计完成后得到的是该系统的系统函数或者差分方程,要实现还需要设计一种具体的算法,这些算法会影响系统的成本以及运算误差等。
本章介绍常用的几种系统结构,即系统算法,同时简明扼要地介绍数字信号处理中的量化效应,最后介绍了MA TLAB 语言中的滤波器设计和分析工具。
本章学习要点如下:(1) 由系统流图写出系统的系统函数或者差分方程。
(2) 按照FIR 系统的系统函数或者差分方程画出其直接型、级联型和频率采样结构,FIR 线性相位结构,以及用快速卷积法实现FIR 系统。
(3) 按照IIR 系统的系统函数或者差分方程画出其直接型、级联型、并联型。
(4) 一般了解格型网络结构,包括全零点格型网络结构系统函数、由FIR 直接型转换成全零点格型网络结构、全极点格型网络结构及其系统函数。
(5) 一般了解如何用软件实现各种网络结构,并排出运算次序。
(6) 数字信号处理中的量化效应,包括A/D 变换器中的量化效应、系数量化效应、运算中的量化效应及其影响。
(7) 了解用MA TLAB 语言设计、分析滤波器。
8.5 习题与上机题解答8.1 已知系统用下面差分方程描述311()(1)(2)()(1)483y n y n y n x n x n =---++- 试分别画出系统的直接型、级联型和并联型结构。
差分方程中()x n 和()y n 分别表示系统的输入和输出信号。
解:311()(1)(2)()(1)483y n y n y n x n x n --+-=+- 将上式进行Z 变换,得到121311()()()()()483Y z Y z z Y z z X z X z z ----+=+ 112113()31148z H z z z ---+=-+ (1) 按照系统函数()H z ,画出直接型结构如图S8.1.1所示。
数字信号处理—原理、实现及应用(第4版)第4章 模拟信号数字处理 学习要点及习题答案
·78· 第4章 模拟信号数字处理4.1 引 言模拟信号数字处理是采用数字信号处理的方法完成模拟信号要处理的问题,这样可以充分利用数字信号处理的优点,本章也是数字信号处理的重要内容。
4.2 本章学习要点(1) 模拟信号数字处理原理框图包括预滤波、模数转换、数字信号处理、数模转换以及平滑滤波;预滤波是为了防止频率混叠,模数转换和数模转换起信号类型匹配转换作用,数字信号处理则完成对信号的处理,平滑滤波完成对数模转换后的模拟信号的进一步平滑作用。
(2) 时域采样定理是模拟信号转换成数字信号的重要定理,它确定了对模拟信号进行采样的最低采样频率应是信号最高频率的两倍,否则会产生频谱混叠现象。
由采样得到的采样信号的频谱和原模拟信号频谱之间的关系式是模拟信号数字处理重要的公式。
对带通模拟信号进行采样,在一定条件下可以按照带宽两倍以上的频率进行采样。
(3) 数字信号转换成模拟信号有两种方法,一种是用理想滤波器进行的理想恢复,虽不能实现,但没有失真,可作为实际恢复的逼近方向。
另一种是用D/A 变换器,一般用的是零阶保持器,虽有误差,但简单实用。
(4) 如果一个时域离散信号是由模拟信号采样得来的,且采样满足采样定理,该时域离 散信号的数字频率和模拟信号的模拟频率之间的关系为T ωΩ=,或者s /F ωΩ=。
(5) 用数字网络从外部对连续系统进行模拟,数字网络的系统函数和连续系统传输函数 之间的关系为j a /(e )(j )T H H ωΩωΩ==,≤ωπ。
数字系统的单位脉冲响应和模拟系统的单位冲激响应关系应为 a a ()()()t nTh n h t h nT === (6) 用DFT (FFT )对模拟信号进行频谱分析(包括周期信号),应根据时域采样定理选择采样频率,按照要求的分辨率选择观测时间和采样点数。
要注意一般模拟信号(非周期)的频谱是连续谱,周期信号是离散谱。
用DFT (FFT )对模拟信号进行频谱分析是一种近似频谱分析,但在允许的误差范围内,仍是很重要也是常用的一种分析方法。
数字信号处理—原理、实现及应用(第4版)第3章 离散傅里叶变换及其快速算法 学习要点及习题答案
·54· 第3章 离散傅里叶变换(DFT )及其快速算法(FFT )3.1 引 言本章是全书的重点,更是学习数字信号处理技术的重点内容。
因为DFT (FFT )在数字信号处理这门学科中起着不一般的作用,它使数字信号处理不仅可以在时域也可以在频域进行处理,使处理方法更加灵活,能完成模拟信号处理完不成的许多处理功能,并且增加了若干新颖的处理内容。
离散傅里叶变换(DFT )也是一种时域到频域的变换,能够表征信号的频域特性,和已学过的FT 和ZT 有着密切的联系,但是它有着不同于FT 和ZT 的物理概念和重要性质。
只有很好地掌握了这些概念和性质,才能正确地应用DFT (FFT ),在各种不同的信号处理中充分灵活地发挥其作用。
学习这一章重要的是会应用,尤其会使用DFT 的快速算法FFT 。
如果不会应用FFT ,那么由于DFT 的计算量太大,会使应用受到限制。
但是FFT 仅是DFT 的一种快速算法,重要的物理概念都在DFT 中,因此重要的还是要掌握DFT 的基本理论。
对于FFT 只要掌握其基本快速原理和使用方法即可。
3.2 习题与上机题解答说明:下面各题中的DFT 和IDFT 计算均可以调用MA TLAB 函数fft 和ifft 计算。
3.1 在变换区间0≤n ≤N -1内,计算以下序列的N 点DFT 。
(1) ()1x n =(2) ()()x n n δ=(3) ()(), 0<<x n n m m N δ=- (4) ()(), 0<<m x n R n m N = (5) 2j()e, 0<<m n N x n m N π=(6) 0j ()e n x n ω=(7) 2()cos , 0<<x n mn m N N π⎛⎫= ⎪⎝⎭(8)2()sin , 0<<x n mn m N N π⎛⎫= ⎪⎝⎭(9) 0()cos()x n n ω=(10) ()()N x n nR n =(11) 1,()0n x n n ⎧=⎨⎩,解:(1) X (k ) =1N kn N n W -=∑=21j0eN kn nn π--=∑=2jj1e1ekN n k nπ---- = ,00,1,2,,1N k k N =⎧⎨=-⎩(2) X (k ) =1()N knNM n W δ-=∑=10()N n n δ-=∑=1,k = 0, 1, …, N -1(3) X (k ) =100()N knNn n n W δ-=-∑=0kn NW 1()N n n n δ-=-∑=0kn NW,k = 0, 1, …, N -1为偶数为奇数·55·(4) X (k ) =1m knN n W -=∑=11kmN N W W --=j (1)sin esin k m N mk N k N π--π⎛⎫⎪⎝⎭π⎛⎫ ⎪⎝⎭,k = 0, 1, …, N -1 (5) X (k ) =21j 0e N mn kn N N n W π-=∑=21j ()0e N m k nNn π--=∑=2j()2j()1e1em k N N m k Nπ--π----= ,0,,0≤≤1N k mk m k N =⎧⎨≠-⎩(6) X (k ) =01j 0eN nknN n W ω-=∑=021j 0e N k nN n ωπ⎛⎫-- ⎪⎝⎭=∑=002j 2j 1e1ek NN k N ωωπ⎛⎫- ⎪⎝⎭π⎛⎫- ⎪⎝⎭--= 0210j 202sin 2e2sin /2N k N N k N k N ωωωπ-⎛⎫⎛⎫- ⎪⎪⎝⎭⎝⎭⎡⎤π⎛⎫- ⎪⎢⎥⎝⎭⎣⎦⎡⎤π⎛⎫- ⎪⎢⎥⎝⎭⎣⎦,k = 0, 1, …, N -1或 X (k ) =00j 2j 1e 1e Nk N ωωπ⎛⎫- ⎪⎝⎭--,k = 0, 1, …, N -1(7) X (k ) =102cos N kn N n mn W N -=π⎛⎫ ⎪⎝⎭∑=2221j j j 01e e e 2N mn mn kn N N N n πππ---=⎛⎫ ⎪+ ⎪⎝⎭∑=21j ()01e 2N m k n N n π--=∑+21j ()01e 2N m k n N n π--+=∑=22j ()j ()22j ()j ()11e 1e 21e 1e m k N m k N N N m k m k N N ππ--+ππ--+⎡⎤--⎢⎥+⎢⎥⎢⎥--⎣⎦=,,20,,N k m k N mk m k N M ⎧==-⎪⎨⎪≠≠-⎩,0≤≤1k N - (8) ()22j j 21()sin ee 2j mn mnN N x n mn N ππ-π⎛⎫== ⎪-⎝⎭ ()()112222j j j ()j ()0011()=e e ee 2j 2j j ,2=j ,20,(0≤≤1)N N kn mn mn m k n m k n N N N N N n n X k W Nk m N k N mk k N --ππππ---+===--⎧-=⎪⎪⎨=-⎪⎪-⎪⎩∑∑其他(9) 解法① 直接计算χ(n ) =cos(0n ω)R N (n ) =00j j 1[e e ]2n n ωω-+R N (n )X (k ) =1()N knNn n W χ-=∑=0021j j j 01[e e ]e 2N kn n n N n ωωπ---=+∑=0000j j 22j j 11e 1e 21e 1e N N k k N N ωωωω-ππ⎛⎫⎛⎫--+ ⎪ ⎪⎝⎭⎝⎭⎡⎤--⎢⎥+⎢⎥⎢⎥--⎣⎦,k = 0, 1, … , N -1 解法② 由DFT 共轭对称性可得同样的结果。
数字信号处理实验4答案.docx
一、实验目的深刻理解离散时间系统的系统函数在分析离散系统的时域特性、频域特性以及稳定性中的重要作用及意义,熟练掌握利用MATLAB分析离散系统的时域响应、频响特性和零极点的方法。
掌握利用DTFT和DFT 确定系统特性的原理和方法。
二、实验原理MATLAB提供了许多可用于分析线性时不变连续系统的函数,主要包含有系统函数、系统时域响应、系统频域响应等分析函数。
1.离散系统的时域响应2.离散系统的系统函数零极点分析3.离散系统的频率响应4.利用DTFT和DFT确定离散系统的特性三、实验内容1.已知某LTI系统的差分方程为:尹[妇-1. 143尹顷一1] + 0. 412尹- 2]=0. 0675x[妇 + 0. 1349x[A - 1] + 0. 0675x[A - 2]1.初始状态y[-1] = 1, y[-2] = 2,输入= 〃伏]计算系统的完全响应.程序:a=[l,-1.143,0.412];b=[O.O675,0.1349,0.0675];n=40;x=ones(l,n);yi=[l,2];zi=filtic(b,a,yi);y=filter(b,a,x,zi);stem(y)(2)当以下三个信号分别通过系统时,分别计算离散系统的零状态响应:X』妇=cos (—; xS_k\ = cos (—= cos (—10 5 10程序n=100;k=0:n-1;a=[l,-1.143,0.412];b=[0.0675,0.1349,0.0675];xl=cos(pi*k/10);x2 = cos (pi*k/5);x3=cos(7*pi*k/10);yl=filter(b,a,xl);y2=filter(b,a,x2);y3=filter(b,a,x3);subplot(3,1,1);stem(k, yl) subplot(3,1,2); stem(k,y2)subplot(3,1,3); stem(k,y3)10 20 30 40 50 60 70 80 90 1002. 已知某因果LTI 系统的系统函数为:m 、0. 03571 + 0. 1428/T + 0. 2143z~2 + 0. 1428z~3 + 0.0357lz~4 H(z) = -------- - ------- § ----------------------- ------------------------------- 7 -------- 1 - 1. 035/T + 0. 8264/2 — Q. 2605/3 + o. 04033z~4 (1) 计算系统的单位脉冲响应。
数字信号处理_习题与解答
[ax (k ) bx (k )]
1 2 2 1 2
x1( k ) b
n n0
k n n0
x (k ) aT[ x (n)] bT[ x (n)]
系统是线性系统 9
( 4)T [ x( n )] x( n n0) ( a )若 | x( n ) | M ,则: | T [ x( n )] || x( n n0 ) | M 系统是稳定系统 (b ) y( n ) x( n n0 ), (i )n0 0, n n0 n, y( n )与n时刻之后的输入无关 系统是因果系统 (ii )n0 0, n n0 n, y( n )与n时刻之后的输入有关 系统不是因果系统 (c ) T [ax1( n ) bx2 ( n )] ax1( n n0 ) bx2 ( n n0 ) aT[ x1( n )] bT[ x2 ( n )] 系统是稳定系统
15
1 2 j n x( n ) X ( j )e d 2 0 1 2 j 2 n x ( 2n ) X ( j )e d 2 0 1 4 j ' n X ( j '/ 2)e d ' ( ' 2) 4 0 1 2 j n 1 4 j n X ( j )e d X ( j )e d 4 0 2 4 2 2 1 2 j n 1 2 2 j n X ( j )e d X( j )e d 2 0 2 4 0 2 2 1 2 1 j n [ X ( j ) X [ j ( )]e d G ( j )e j d 0 0 2 2 2 2 16
数字信号处理-基于计算机的方法(第四版)答案 8-11章
Copyright © 2011 by Sanjit K. Mitra. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of Sanjit K. Mitra, including, but not limited to, in any network or other electronic Storage or transmission, or broadcast for distance learning.
D = 2〈2−1 〉 5 = 6.
€
€
⎧0 ≤ n1 ≤ 4, Thus, n = 〈5 n1 + 2 n 2 〉10 , ⎨ ⎩0 ≤ n 2 ≤ 2, ⎧0 ≤ k ≤ 4, k = 〈5 k1 + € 6 k 2 〉10 , ⎨ €1 ⎩0 ≤ k 2 ≤ 2. The corresponding€ index mappings are indicated below:
数字信号处理第4章习题解答教材
DFT [x2 (n)]
DFT {Im[ w(n )]}
1 j Wop (k )
1 2j
[W
((k )) N
W
* (( N
k )) N
]RN
(k)
解:由题意 X k DFT xn,Y k DFT y n 构造序列 Z k X k jY k 对Z k 作一次N点IFFT可得序列z n z(n) IDFT Z k
Re[w(n)] j Im[w(n)]
Wep (k) Wop (k)
由x1(n) Re[w(n)]得
X1(k) DFT[x1(n)] DFT{Re[w(n)]} Wep (k)
1 2
[W
((k
))
N
W *((N
k ))N
]RN
(k)
由x2 (n) Im[w(n)]得
X 2 (k )
(2) 按频率抽取的基-2FFT流图
同样共有L = 4级蝶形运算,每级N / 2 = 8个蝶形运算
基本蝶形是DIT 蝶形的转置
X m1(k )
X m1( j)
WNr
-1
X m (k ) Xm( j)
每个蝶形的两节点距离为2Lm ,即从第一级到 第四级两节点距离分别为8,4,2,1。
系数WNr的确定:r (k )2 2m1 即k的二进制左移m 1位补零
3. N=16 时,画出基 -2 按时间抽取法及按频率抽取法 的 FFT 流图(时间抽取采用输入倒位序,输出自然数 顺序,频率抽取采用输入自然顺序,输出倒位序)。
解: 自然序
倒位序
0 0000 0000 0 1 0001 1000 8 2 0010 0100 4 3 0011 1100 12 4 0100 0010 2 5 0101 1010 10 6 0110 0110 6 7 0111 1110 14
数字信号处理 答案 第四章
z −1
r sin θ
− r sin θ r cos θ
y ( n)
z −1
网络Ⅱ 解 网络Ⅰ:根据信号流程图写出差分方程
y (n) = 2r cos θ y (n − 1) − r 2 y (n − 2) + x(n)
由差分方程得系统函数
H1 ( z ) =
Y ( z) 1 = X ( z ) 1 − 2r cos θ z −1 + r 2 z −1 1 )(rz −1 − e jθ )
(4)并联型
x ( n)
z −1
1/4 10/3
-7/3
y ( n)
z −1
1/2 将系统函数写成部分分式形式
H ( z) =
−7 / 3 10 / 3 + 1 −1 1 1− z 1 − z −1 4 2
4.4 用直接Ⅰ型和直接Ⅱ型结构实现以下系统函数; (1)
H(z)=
−5 + 2 z −1 − 0.5 z −2 1 + 3z −1 + 3z −2 + z −3
3z 3 + 2 z 2 + 2 z + 5 (2) H(x)=0.8 3 z + 4 z 2 + 3z + 2
解 (1)根据系统函数写出差分方程
y (n) + 3 y (n − 1) + 3 y (n − 2) + y (n − 3) = −5 x(n) + 2 x(n − 1) − 0.5 x(n − 2)
可见网络Ⅰ和网络Ⅱ具有相同极点。 4.3 一个因果线性离散系统由下列差分方程描述:
3 1 1 y(n)- y(n-1)+ y(n-2)=x(n)+ x(n-1) 4 8 3
数字信号处理》课后作业参考答案
第3章 离散时间信号与系统时域分析3.1画出下列序列的波形(2)1()0.5(1)n x n u n -=- n=0:8; x=(1/2).^n;n1=n+1; stem(n1,x);axis([-2,9,-0.5,3]); ylabel('x(n)'); xlabel('n');(3) ()0.5()nx n u n =-()n=0:8; x=(-1/2).^n;stem(n,x);axis([-2,9,-0.5,3]); ylabel('x(n)'); xlabel('n');3.8 已知1,020,36(),2,780,..n n x n n other n≤≤⎧⎪≤≤⎪=⎨≤≤⎪⎪⎩,14()0..n n h n other n≤≤⎧=⎨⎩,求卷积()()*()y n x n h n =并用Matlab 检查结果。
解:竖式乘法计算线性卷积: 1 1 1 0 0 0 0 2 2)01 2 3 4)14 4 4 0 0 0 0 8 83 3 3 0 0 0 0 6 62 2 2 0 0 0 0 4 41 1 1 0 0 0 02 21 3 6 9 7 4 02 6 10 14 8)1x (n )nx (n )nMatlab 程序:x1=[1 1 1 0 0 0 0 2 2]; n1=0:8; x2=[1 2 3 4]; n2=1:4; n0=n1(1)+n2(1);N=length(n1)+length(n2)-1; n=n0:n0+N-1; x=conv(x1,x2); stem(n,x);ylabel('x(n)=x1(n)*x2(n)');xlabel('n'); 结果:x = 1 3 6 9 7 4 0 2 6 10 14 83.12 (1) 37πx (n )=5sin(n) 解:2214337w πππ==,所以N=14 (2) 326n ππ-x (n )=sin()-sin(n)解:22211213322212,2122612T N w T N w N ππππππ=========,所以(6) 3228n π-x (n )=5sin()-cos(n) 解:22161116313822222()T N w T w x n ππππππ=======,为无理数,所以不是周期序列所以不是周期序列3.20 已知差分方程2()3(1)(2)2()y n y n y n x n --+-=,()4()nx n u n -=,(1)4y -=,(2)10,y -=用Mtalab 编程求系统的完全响应和零状态响应,并画出图形。
数字信号处理实验指导书思考题答案实验图
目录实验一 Matlab与数字信号处理基础 (2)实验二离散傅里叶变换与快速傅里叶变换 (4)实验三数字滤波器结构 (6)注释 (9)主要参考文献 (9)实验一 Matlab与数字信号处理基础一、实验目的和任务1、熟悉Matlab的操作环境2、学习用Matlab建立基本序列的方法;3、学习用仿真界面进行信号抽样的方法。
二、实验内容1、基本序列的产生:单位抽样序列、单位阶跃序列、矩形序列、实指数序列和复指数序列的产生2、用仿真界面进行信号抽样练习:用simulink建模仿真信号的抽样三、实验仪器、设备及材料计算机、Matlab软件四、实验原理序列的运算、抽样定理五、主要技术重点、难点Matlab的各种命令与函数、建模仿真抽样定理六、实验步骤1、基本序列的产生:单位抽样序列δ(n): n=-2:2;x=[0 0 1 0 0];stem(n,x);单位阶跃序列u(n):n=-10:10;x=[zeros(1,10) ones(1,11)];stem(n,x);矩形序列R N(n):n=-2:10;x=[0 0 ones(1,5) zeros(1,6)];stem(n,x);实指数序列0.5n:n=0:30;x=0.5.^nstem(n,x);复指数序列e(-0.2+j0. 3)n:n=0:30;x=exp((-0.2+j*0.3)*n);模:stem(n,abs(x));幅角:stem(n,angle(x));2、用仿真界面进行信号抽样练习:(1)在Matlab命令窗口中输入simulink 并回车,以打开仿真模块库;(2)按CTRL+N,以新建一仿真窗口;在仿真模块库中用鼠标点击Sources(输入源模块库),从中选择sine wave(正弦波模块)并将其拖至仿真窗口;(3)在仿真模块库中用鼠标点击Discrete(离散模块库),从中选择Zero-Order Hold(零阶保持器模块)并将其拖至仿真窗口;(4)在仿真模块库中用鼠标点击Sinks(显示模块库),从中选择Scope(示波器模块)并将其拖至仿真窗口;(5)在仿真窗口中把上述模块依次连接起来;(6)用鼠标双击Scope模块,以打开示波器的显示界面;(7)用鼠标点击仿真窗口工具条中的►图标开始仿真,结果显示在示波器中;(8)用鼠标双击Zero-Order Hold模块,打开其参数设置窗口,改变sample time参数值,例如1、0.5、0.1、0.05…,用鼠标点击仿真窗口工具条中的►图标开始仿真,比较示波器显示结果(选三个参数值,得三个结果);(9)在仿真模块库中用鼠标点击Sinks(显示模块库),从中选择To Workspace(输出到当前工作空间的变量模块)并将其拖至仿真窗口;(10)用鼠标双击To Workspace模块,打开其参数设置窗口,改变variable name参数值为x ;同时把save format参数值设置为Array ;(11)在仿真窗口中先用鼠标点击Zero-Order Hold模块与Scope模块的连线,然后按住CTRL 键,从选中连线的中部引出一条线到To Workspace模块;(12)用鼠标双击Zero-Order Hold模块,打开其参数设置窗口,改变sample time参数值,例如1、0.5、0.1、0.05…,用鼠标点击仿真窗口工具条中的►图标开始仿真,并返回命令窗口,用stem(x)作图,比较序列图显示结果(选三个参数值,得三个结果);七、实验报告要求1、实验步骤按实验内容指导进行;2、对于实验内容1和2的数据必须给出的离散图,其相关参数应在图中注明;3、具有关联性和比较性的图形最好用subplot()函数,把它们画在一起;4、实验报告按规定格式填写,要求如下:(1)实验步骤根据自己实际操作填写;(2)各小组实验数据不能完全相同,否则以缺席论处;5、实验结束,实验数据交指导教师检查,得到允许后可以离开,否则以缺席论处;八、实验注意事项1、Matlab编程、文件名、存盘目录均不能使用中文。
数字信号处理—原理、实现及应用(第4版)第1章 时域离散信号和系统 学习要点及习题答案
·1·第1章 时域离散信号和系统1.1 引 言本章内容是全书的基础。
学生从学习模拟信号分析与处理到学习数字信号处理,要建立许多新的概念,数字信号和数字系统与原来的模拟信号和模拟系统不同,尤其是处理方法上有本质的区别。
模拟系统用许多模拟器件完成,数字系统用运算方法完成。
如果对本章中关于数字信号与系统的若干基本概念不清楚,那么在学习数字滤波器时,会感到不好掌握,因此学好本章是很重要的。
1.2 本章学习要点(1) 关于信号● 模拟信号、时域离散信号、数字信号三者之间的区别。
● 如何由模拟信号产生时域离散信号。
● 常用的时域离散信号。
● 如何判断信号是周期性的,其周期如何计算。
(2) 关于系统● 什么是系统的线性、时不变性,以及因果性、稳定性;如何判断。
● 线性、时不变系统输入和输出之间的关系;求解线性卷积的图解法、列表法、解析法,以及用MA TLAB 工具箱函数求解。
● 线性常系数差分方程的递推解法。
● 用MA TLAB 求解差分方程。
● 什么是滑动平均滤波器,它的单位脉冲响应是什么。
1.3 习题与上机题解答1.1 用单位脉冲序列及其加权和表示图P1.1所示的序列。
解:()(2)(1)2()(1)2(2)3(3)(4)2(6)x n n n n n n n n n δδδδδδδδ=+-+++-+-+-+-+-1.2 给定信号24,4≤≤1()4,0≤≤40,n n x n n +--⎧⎪=⎨⎪⎩其他 (1) 画出x (n )的波形,标上各序列值;(2) 试用延迟的单位脉冲序列及其加权和表示x (n )序列; (3) 令1()2(2)x n x n =-,画出1()x n 的波形; (4) 令2()(2)x n x n =-,画出2()x n 的波形。
·2·解:(1) 画出x (n )的波形,如图S1.2.1所示。
图P1.1 图S1.2.1(2) ()4(4)2(3)2(1)4()4(1)4(2)4(3)4(4)x n n n n n n n n n δδδδδδδδ=+-+++++-+-+-+--。
数字信号处理米特拉第四版实验二答案
Name: SOLUTIONSection:Laboratory Exercise 2DISCRETE-TIME SYSTEMS: TIME-DOMAIN REPRESENTATION 2.1 SIMULATION OF DISCRETE-TIME SYSTEMSProject 2.1The Moving Average SystemA copy of Program P2_1 is given below:% Program P2_1% Simulation of an M-point Moving Average Filter% Generate the input signaln = 0:100;s1 = cos(2*pi*0.05*n); % A low-frequency sinusoids2 = cos(2*pi*0.47*n); % A high frequency sinusoidx = s1+s2;% Implementation of the moving average filterM = input('Desired length of the filter = ');num = ones(1,M);y = filter(num,1,x)/M;% Display the input and output signalsclf;subplot(2,2,1);plot(n, s1);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude');title('Signal #1');subplot(2,2,2);plot(n, s2);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude');title('Signal #2');subplot(2,2,3);plot(n, x);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude');title('Input Signal');subplot(2,2,4);plot(n, y);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude');title('Output Signal');axis;Answers:Q2.1 The output sequence generated by running the above program for M = 2 with x[n] =s1[n]+s2[n] as the input is shown below .50100-2-1012Time index n A m p l i t u d eSignal #150100-2-1012Time index n A m p l i t u d eSignal #250100-2-1012Time index nA m p l i t u d eInput Signal50100-2-1012Time index nA m p l i t u d eOutput SignalThe component of the input x[n] suppressed by the discrete-time system simulated by this program is – Signal #2, the high frequency one (it is a low pass filter).Q2.2Program P2_1 is modified to simulate the LTI system y[n] = 0.5(x[n]–x[n–1]) and process the input x[n] = s1[n]+s2[n] resulting in the output sequence shown below :Note: the code is not required; however, it is included here to demonstrate a tricky way ofmaking the modification to P2_1.% Program Q2_2% Modification of P1_1 to convert it to a high pass filter % Generate the input signal n = 0:100;s1 = cos(2*pi*0.05*n); % A low-frequency sinusoid s2 = cos(2*pi*0.47*n); % A high frequency sinusoid x = s1+s2;% Implementation of high pass filterM = input('Desired length of the filter = ');% By comparing eq. (2.13) to (2.3), you can see that "num" % actually contains the impulse response (times the constant % M). What we are actually doing in Q2.2 is multiplying the % impulse response of the low pass filter in P2_1 by the % sequency (-1)^n. This shifts the low pass frequency% response up to be centered at f=0.25, making it a high % pass filter.num = (-1).^[0:M-1]; y = filter(num,1,x)/M;% Display the input and output signals clf;subplot(2,2,1); plot(n, s1);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude'); title('Signal #1'); subplot(2,2,2); plot(n, s2);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude'); title('Signal #2'); subplot(2,2,3); plot(n, x);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude'); title('Input Signal'); subplot(2,2,4); plot(n, y);axis([0, 100, -2, 2]);xlabel('Time index n'); ylabel('Amplitude'); title('Output Signal'); axis;Time index n A m p l i t u d eSignal #1-2-1012Time index n A m p l i t u d eSignal #2Time index nA m p l i t u d eInput Signal-2-1012Time index nA m p l i t u d eOutput SignalThe effect of changing the LTI system on the input is – The system is now a high pass filter.It passes the high-frequency input component s2 instead of the low frequency input component s1.Q2.3Program P2_1 is run for the following values of filter length M and following values of the fre-quencies of the sinusoidal signals s1[n] and s2[n]. The output generated for these different values of M and the frequencies are shown below.f1=0.05; f2=0.47; M=1550100-2-1012Time index n A m p l i t u d eSignal #150100Time index n A m p l i t u d eSignal #250100-2-1012Time index nA m p l i t u d eInput Signal50100Time index nA m p l i t u d eOutput SignalFrom these plots we make the following observations – with M=15, the low passcharacteristic is much more pronounced (the passband is now very narrow). s2 is still nearly eliminated in the output signal. s1 is still passed, but at an attenuated level.f1=0.30; f2=0.47; M=4-2-1012Time index n A m p l i t u d eSignal #1Time index n A m p l i t u d eSignal #2-2-1012Time index nA m p l i t u d eInput SignalTime index nA m p l i t u d eOutput SignalFrom these plots we make the following observations – with M=4, this filter performs moresmoothing than in the case M=2. Both s1 and s2 are high frequency in this case, and they are both substantially attenuated in the output.f1=0.05; f2=0.10; M=3-2-1012Time index n A m p l i t u d eSignal #1Time index n A m p l i t u d eSignal #2-2-1012Time index nA m p l i t u d eInput SignalTime index nA m p l i t u d eOutput SignalFrom these plots we make the following observations – here s1 and s2 are both low passand they are both visible in the filter output. However, s2, the higher frequency input,is attenuated slightly more than s1 in the system output.Q2.4 The required modifications to Program P2_1 by changing the input sequence to a swept-frequency sinusoidal signal (length 101, minimum frequency 0, and a maximum frequency 0.5) as the input signal (see Program P1_7) are listed below:% Program Q2_4% Modify P2_1 to use a swept frequency chirp input% Generate the input signaln = 0:100;a = pi/200;b = 0;arg = a*n.*n + b*n;x = cos(arg);% Implementation of the moving average filterM = input('Desired length of the filter = ');num = ones(1,M);y = filter(num,1,x)/M;% Display the input and output signalsclf;subplot(2,1,1);plot(n, x);axis([0, 100, -1.5, 1.5]);xlabel('Time index n'); ylabel('Amplitude');title('Input Signal');subplot(2,1,2);plot(n, y);axis([0, 100, -1.5, 1.5]);xlabel('Time index n'); ylabel('Amplitude');title('Output Signal');axis;The output signal generated by running this program is plotted below .102030405060708090100-101Time index n A m p l i t u d eInput Signal102030405060708090100-101Time index nA m p l i t u d eOutput SignalThe results of Questions Q2.1 and Q2.2 from the response of this system to the swept-frequency signal can be explained as follows : we see again that this system is a low passfilter. At the left of the graphs, the input signal is a low frequency sinusoid that is passed to the output without attenuation. As n increases, the frequency of the input rises, and increasing attenuation is seen at the output. In Q2.1, the input was a sum of two sinusoids s1 and s2 with f1=0.05 and f2=0.47. The swept frequency input of Q2.4 reaches a frequency of 0.05 at n=10, where there is virtually no attenuation in the output shown above. This “explains” why s1 was passed by the system in Q2.1. The swept frequency input of Q2.4 reaches a frequency of 0.47 at approximately n=94, where the attenuation of the system is substantial. This “explains” why s2 was almost completely suppressed in the output in Q2.1.There is no direct relationship between the result shown above for Q2.4 and the result obtained in Q2.2. However, using frequency domain concepts (Chapter 3) we can reason that, if the swept frequency signal was input to the system y[n] = 0.5(x[n] – x[n-1]), we would see a result opposite to what is shown above. Since the system would then be a high pass filter, there would be substantial attenuation of the output at the left side of the graph and virtually no attenuation at the right side of the graph. This “explains” why in Q2.2 the low frequency component s1 was suppressed in the system output, whereas the high frequency component s2 was passed.Project 2.2 (Optional) A Simple Nonlinear Discrete-Time SystemA copy of Program P2_2 is given below:% Program P2_2% Generate a sinusoidal input signalclf;n = 0:200;x = cos(2*pi*0.05*n);% Compute the output signalx1 = [x 0 0]; % x1[n] = x[n+1]x2 = [0 x 0]; % x2[n] = x[n]x3 = [0 0 x]; % x3[n] = x[n-1]y = x2.*x2-x1.*x3;y = y(2:202);% Plot the input and output signalssubplot(2,1,1)plot(n, x)xlabel('Time index n');ylabel('Amplitude');title('Input Signal')subplot(2,1,2)plot(n,y)xlabel('Time index n');ylabel('Amplitude');title('Output signal');Answers:Q2.5The sinusoidal signals with the following frequencies as the input signals were used to generate the output signals: f=0.05, f=0.1, f=0.25The output signals generated for each of the above input signals are displayed below:Time index nA m p l i t u d eTime index nA m p l i t u d eOutput SignalTime index nA m p l i t u d eThe output signals depend on the frequencies of the input signal according to the following rules : up to “edge effects” visible at the very left and right sides of the first graph, theoutput is given by y[n] = sin 2(2πf).This observation can be explained mathematically as follows : Let 2f ω=π. Then[]cos()x n n =ω and22[]cos ()x n n =ω (1.1)Now, [1]cos[(1)]cos()x n n n +=ω+=ω+ω and [1]cos[(1)]x n n −=ω−= cos()n ω−ω, so [1][1]cos()cos()x n x n n n +−=ω+ωω−ω. Applying the trigonometric identity 1122cos()cos()cos(2)cos(2)A B A B A B +−=+, this becomes11[1][1]cos(2)cos(2).22x n x n n +−=ω+ω (1.2) Applying the trigonometric identity 2cos(2)2cos ()1A A =− to the first term of (1.2), we obtain211[1][1]cos ()cos(2).22x n x n n +−=ω−+ω (1.3)Applying the identity 2cos(2)12sin ()A A =−to the second term of (1.3) gives us22[1][1]cos ()sin ().x n x n n +−=ω−ω (1.4)It follows immediately from (1.1) and (1.4) that222[][][1][1]sin ()sin (2).y n x n x n x n f =−+−=ω=πQ2.6The output signal generated by using sinusoidal signals of the form x[n] = sin(ωo n) +K as the input signal is shown below for the following values of ωo and K -ωo = 0.1; K = 0.5Time index nA m p l i t u d eOutput SignalThe dependence of the output signal y[n] on the DC value K can be explained as –Again let2.f ω=π Then []cos()x n n K =ω+ and222[]cos ()2cos().x n n K n K =ω+ω+ (1.5)We have [1]cos[(1)]cos()x n n K n K +=ω++=ω+ω+and[1]cos[(1)]cos().x n n K n K −=ω−+=ω−ω+ So2[1][1]cos()cos()cos()cos().x n x n n n K n K n K +−=ω+ωω−ω+ω+ω+ω−ω+(1.6)From (1.4), we have that 22cos()cos()cos ()sin (),n n n n ω+ωω−ω=ω−ωso (1.6) may be written as222[1][1]cos ()sin ()[cos()cos()].x n x n n n K n n K +−=ω−ω+ω+ω+ω−ω+(1.7)Applying the trigonometric identity cos()cos()2cos()cos()A B A B A B ++−=to the term in square brackets in (1.7), we have that22[1][1]cos ()sin ()2cos()cos()2.x n x n K n K +−=ω−ω+ωω+Combining the this result with (1.5), it follows immediately that2[]sin (2)2[1cos(2)]cos(2).y n f K f fn =π+−ππSo addition of the constant K to the input cosine signal has the effect of adding a ripple onto the result that was obtained before in Q2.5. This ripple is a cosine wave of frequency f and amplitude 2[1cos(2)],K f −πas can be seen plainly in the graph above.Project 2.3Linear and Nonlinear SystemsA copy of Program P2_3 is given below :% Program P2_3% Generate the input sequences clf;n = 0:40; a = 2;b = -3;x1 = cos(2*pi*0.1*n); x2 = cos(2*pi*0.4*n); x = a*x1 + b*x2;num = [2.2403 2.4908 2.2403]; den = [1 -0.4 0.75];ic = [0 0]; % Set zero initial conditionsy1 = filter(num,den,x1,ic); % Compute the output y1[n] y2 = filter(num,den,x2,ic); % Compute the output y2[n] y = filter(num,den,x,ic); % Compute the output y[n] yt = a*y1 + b*y2;d = y - yt; % Compute the difference output d[n] % Plot the outputs and the difference signal subplot(3,1,1) stem(n,y);ylabel('Amplitude');title('Output Due to Weighted Input: a \cdot x_{1}[n] + b \cdot x_{2}[n]'); subplot(3,1,2) stem(n,yt);ylabel('Amplitude');title('Weighted Output: a \cdot y_{1}[n] + b \cdot y_{2}[n]'); subplot(3,1,3) stem(n,d);xlabel('Time index n');ylabel('Amplitude'); title('Difference Signal');Answers: Q2.7The outputs y[n], obtained with weighted input, and yt[n], obtained by combining the two outputs y1[n] and y2[n] with the same weights, are shown below along with the difference between the two signals :0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]x 10-15Time index nA m p l i t u d eDifference SignalThe two sequences are – the same up to numerical roundoff. The system is – Linear.Q2.8 Program P2_3 was run for the following three different sets of values of the weightingconstants, a and b , and the following three different sets of input frequencies :1. a=1; b=-1; f1=0.05; f2=0.4;2. a=10; b=2; f1=0.10; f2=0.25;3. a=2; b=10; f1=0.15; f2=0.20;The plots generated for each of the above three cases are shown below :0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540x 10-15Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540x 10-14Time index nA m p l i t u d eDifference SignalA m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540x 10-14Time index nA m p l i t u d eDifference SignalBased on these plots we can conclude that the system with different weights is – Linear.Q2.9 Program 2_3 was run with the following non-zero initial conditions – ic = [5 10];The plots generated are shown below -A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]Time index nA m p l i t u d eDifference SignalBased on these plots we can conclude that the system with nonzero initial conditions is –Nonlinear.Q2.10Program P2_3 was run with nonzero initial conditions and for the following three different sets of values of the weighting constants, a and b , and the following three different sets of input frequencies :1. a=1; b=-1; f1=0.05; f2=0.4;2. a=10; b=2; f1=0.10; f2=0.25;3. a=2; b=10; f1=0.15; f2=0.20;The plots generated for each of the above three cases are shown below :0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540Time index nA m p l i t u d eDifference SignalBased on these plots we can conclude that the system with nonzero initial conditions and different weights is – Nonlinear.Q2.11 Program P2_3 was modified to simulate the system :y[n] = x[n]x[n –1]The output sequences y1[n], y2[n],and y[n]of the above system generated by running the modified program are shown below :0510152025303540y 1[n]0510152025303540y 2[n]y t [n]0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]0510152025303540A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540Time index nA m p l i t u d eDifference SignalComparing y[n] with yt[n] we conclude that the two sequences are – Not the Same. This system is – Nonlinear.Project 2.4 Time-invariant and Time-varying SystemsA copy of Program P2_4 is given below:% Program P2_4% Generate the input sequencesclf;n = 0:40; D = 10;a = 3.0;b = -2;x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);xd = [zeros(1,D) x];num = [2.2403 2.4908 2.2403];den = [1 -0.4 0.75];ic = [0 0]; % Set initial conditions% Compute the output y[n]y = filter(num,den,x,ic);% Compute the output yd[n]yd = filter(num,den,xd,ic);% Compute the difference output d[n]d = y - yd(1+D:41+D);% Plot the outputssubplot(3,1,1)stem(n,y);ylabel('Amplitude');title('Output y[n]'); grid;subplot(3,1,2)stem(n,yd(1:41));ylabel('Amplitude');title(['Output due to Delayed Input x[n Ð', num2str(D),']']); grid; subplot(3,1,3)stem(n,d);xlabel('Time index n'); ylabel('Amplitude');title('Difference Signal'); grid;Answers: Q2.12The output sequences y[n] and yd[n] generated by running Program P2_4 are shown below -0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]Time index nA m p l i t u d eDifference SignalThese two sequences are related as follows – y[n-10] = yd[n].The system is – Time Invariant.Q2.13 The output sequences y[n] and yd[n] generated by running Program P2_4 for thefollowing values of the delay variable D – 2; 6; 8.are shown below -0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -2]0510152025303540Time index nA m p l i t u d eDifference Signal510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -6]0510152025303540Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -8]0510152025303540Time index nA m p l i t u d eDifference SignalIn each case, these two sequences are related as follows – y[n-D] = yd[n].The system is – Time Invariant.Q2.14 The output sequences y[n] and yd[n] generated by running Program P2_4 for thefollowing values of the input frequencies –1. f1=0.05; f2=0.40;2. f1=0.10; f2=0.25;3. f1=0.15; f2=0.20;are shown below –0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference Signal510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference SignalIn each case, these two sequences are related as follows – y[n-10] = yd[n].The system is – Time Invariant.Q2.15The output sequences y[n] and yd[n] generated by running Program P2_4 for non-zero initial conditions are shown below –0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference SignalThese two sequences are related as follows – yd[n] is NOT equal to the shift of y[n].The system is – Time Varying.Q2.16The output sequences y[n] and yd[n] generated by running Program P2_4 for non-zero initial conditions and following values of the input frequencies –1. f1=0.05; f2=0.40;2. f1=0.10; f2=0.25;3. f1=0.15; f2=0.20;are shown below -0510152025303540A m p l i t u d eOutput y[n]A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference Signal0510152025303540A m p l i t u d eOutput y[n]510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference SignalA m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference SignalIn each case, these two sequences are related as follows – yd[n] is NOT given by theshift of y[n].The system is – Time Varying.Q2.17The modified Program 2_4 simulating the systemy[n] = n x[n] + x[n-1]is given below :% Program Q2_17% Modification of P2_4 to implement the system% given by (2.16).% Generate the input sequencesclf;n = 0:40; D = 10;a = 3.0;b = -2;x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);xd = [zeros(1,D) x];nd = 0:length(xd)-1;% Compute the output y[n]y = (n .* x) + [0 x(1:40)];% Compute the output yd[n]yd = (nd .* xd) + [0 xd(1:length(xd)-1)];% Compute the difference output d[n]d = y - yd(1+D:41+D);% Plot the outputssubplot(3,1,1)stem(n,y);ylabel('Amplitude');title('Output y[n]'); grid;subplot(3,1,2)stem(n,yd(1:41));ylabel('Amplitude');title(['Output due to Delayed Input x[n -', num2str(D),']']); grid;subplot(3,1,3)stem(n,d);xlabel('Time index n'); ylabel('Amplitude');title('Difference Signal'); grid;The output sequences y[n]and yd[n] generated by running modified Program P2_4 are shown below -0510152025303540A m p l i t u d eOutput y[n]0510152025303540A m p l i t u d eOutput due to Delayed Input x[n -10]0510152025303540Time index nA m p l i t u d eDifference SignalThese two sequences are related as follows – yd[n] is NOT the shifted version of y[n]. The system is – Time Varying.Q2.18 (optional) The modified Program P2_3 to test the linearity of the system of (2.16) is shown below :% Program Q2_18% Modify P2_3 for Q2.18.% Generate the input sequences clf;n = 0:40; a = 2;b = -3;x1 = cos(2*pi*0.1*n); x2 = cos(2*pi*0.4*n); x = a*x1 + b*x2;y1 = (n .* x1) + [0 x1(1:40)]; % Compute the output y1[n] y2 = (n .* x2) + [0 x2(1:40)]; % Compute the output y2[n] y = (n .* x) + [0 x(1:40)]; % Compute the output y[n] yt = a*y1 + b*y2;d = y - yt; % Compute the difference output d[n] % Plot the outputs and the difference signal subplot(3,1,1) stem(n,y);ylabel('Amplitude');title('Output Due to Weighted Input: a \cdot x_{1}[n] + b \cdot x_{2}[n]'); subplot(3,1,2)stem(n,yt);ylabel('Amplitude');title('Weighted Output: a \cdot y_{1}[n] + b \cdot y_{2}[n]'); subplot(3,1,3) stem(n,d);xlabel('Time index n');ylabel('Amplitude'); title('Difference Signal');The outputs y[n]and yt[n] obtained by running the modified program P2_3 are shown below :0510152025303540A m p l i t u d eOutput Due to Weighted Input: a ⋅ x 1[n] + b ⋅ x 2[n]A m p l i t u d eWeighted Output: a ⋅ y 1[n] + b ⋅ y 2[n]0510152025303540x 10-14Time index nA m p l i t u d eDifference SignalThe two sequences are – The same up to numerical roundoff.The system is – Linear.2.5 LINEAR TIME-INVARIANT DISCRETE-TIME SYSTEMS Project 2.5Computation of Impulse Responses of LTI SystemsA copy of Program P2_5 is shown below :% Program P2_5% Compute the impulse response y clf; N = 40;num = [2.2403 2.4908 2.2403]; den = [1 -0.4 0.75]; y = impz(num,den,N);% Plot the impulse response stem(y);xlabel('Time index n'); ylabel('Amplitude'); title('Impulse Response'); grid;Answers:Q2.19 The first 41 samples of the impulse response of the discrete-time system of Project 2.3generated by running Program P2_5 is given below:-3-2-11234Time index nA m p l i t u d eImpulse ResponseQ2.20 The required modifications to Program P2_5 to generate the impulse response of the followingcausal LTI system :y[n] + 0.71y[n-1] – 0.46y[n-2] – 0.62y[n-3]= 0.9x[n] – 0.45x[n-1] + 0.35x[n-2] + 0.002x[n-3]are given below :% Program Q2_20% Compute the impulse response y clf; N = 45;num = [0.9 -0.45 0.35 0.002]; den = [1.0 0.71 -0.46 -0.62]; y = impz(num,den,N);% Plot the impulse response stem(y);xlabel('Time index n'); ylabel('Amplitude'); title('Impulse Response'); grid;The first 45 samples of the impulse response of this discrete-time system generated by running the modified is given below :051015202530354045-1.5-1-0.50.511.52Time index nA m p l i t u d eImpulse Responsethe filter command is indicated below :% Program Q2_21% Compute the impulse response y clf; N = 40;num = [0.9 -0.45 0.35 0.002]; den = [1.0 0.71 -0.46 -0.62]; % input: unit pulse x = [1 zeros(1,N-1)]; % outputy = filter(num,den,x);% Plot the impulse response% NOTE: the time axis will be WRONG; h[0] will % be plotted at n=1; but this will agree with % the INCORRECT plotting that was also done % by program P2_5. stem(y);xlabel('Time index n'); ylabel('Amplitude'); title('Impulse Response'); grid;The first 40 samples of the impulse response generated by this program are shown below :0510152025303540-1.5-1-0.50.511.52Time index nA m p l i t u d eImpulse ResponseComparing the above response with that obtained in Question Q2.20 we conclude - They are the SAME.indicated below :% Program Q2_22% Compute the step response s clf; N = 40; n = 0:N-1;num = [2.2403 2.4908 2.2403]; den = [1.0 -0.4 0.75]; % input: unit step x = [ones(1,N)]; % outputy = filter(num,den,x); % Plot the step response stem(n,y);xlabel('Time index n'); ylabel('Amplitude'); title('Step Response'); grid;The first 40 samples of the step response of the LTI system of Project 2.3 are shown below :0510152025303540Time index nA m p l i t u d eStep ResponseProject 2.6 Cascade of LTI SystemsA copy of Program P2_6 is given below:% Program P2_6% Cascade Realizationclf;x = [1 zeros(1,40)]; % Generate the inputn = 0:40;% Coefficients of 4th order systemden = [1 1.6 2.28 1.325 0.68];num = [0.06 -0.19 0.27 -0.26 0.12];% Compute the output of 4th order systemy = filter(num,den,x);% Coefficients of the two 2nd order systemsnum1 = [0.3 -0.2 0.4];den1 = [1 0.9 0.8];num2 = [0.2 -0.5 0.3];den2 = [1 0.7 0.85];% Output y1[n] of the first stage in the cascadey1 = filter(num1,den1,x);% Output y2[n] of the second stage in the cascadey2 = filter(num2,den2,y1);% Difference between y[n] and y2[n]d = y - y2;% Plot output and difference signalssubplot(3,1,1);stem(n,y);ylabel('Amplitude');title('Output of 4th order Realization'); grid;subplot(3,1,2);stem(n,y2)ylabel('Amplitude');title('Output of Cascade Realization'); grid;subplot(3,1,3);stem(n,d)xlabel('Time index n');ylabel('Amplitude');title('Difference Signal'); grid;Answers:Q2.23The output sequences y[n], y2[n], and the difference signal d[n]generated by running Program P2_6 are indicated below:。
数字信号实验第四章答案教材
数字信号处理实验报告4线性时不变离散时间系统频域分析一、实验目的通过使用matlab做实验来加强对传输函数的类型和频率响应和稳定性测试来强化理解概念。
4.1 传输函数分析回答:Q4.1 修改程序P3_1去不同的M值,当0<w<2pi时计算并画出式(2.13)所示滑动平均滤波器的幅度和相位谱,代码如下:% Program Q4_1% Frequency response of the causal M-point averager of Eq. (2.13)clear;% User specifies filter lengthM = input('Enter the filter length M: ');% Compute the frequency samples of the DTFTw = 0:2*pi/1023:2*pi;num = (1/M)*ones(1,M);den = [1];% Compute and plot the DTFTh = freqz(num, den, w);subplot(2,1,1)plot(w/pi,abs(h));gridtitle('Magnitude Spectrum |H(e^{j\omega})|')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,angle(h));gridtitle('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi');ylabel('Phase in radians');所得结果如图示:M=2M=7幅度和相位谱表现出对称性的类型是由于–冲激响应是实数,因此频率响应是周期且对称的,幅度谱是周期甚至对称的,相位响应是周期奇对称。
数字信号处理课后习题答案(全)1-7章PPT课件
第 1 章 时域离散信号和时域离散系统
(2) 令输入为
输出为
x(n-n0)
y′(n)=2x(n-n0)+3 y(n-n0)=2x(n-n0)+3=y′(n) 故该系统是非时变的。 由于
T[ax1(n)+bx2(n)]=2ax1(n)+2bx2(n)+3 T[ax1(n)]=2ax1(n)+3 T[bx2(n)]=2bx2(n)+3 T[ax1(n)+bx2(n)]≠aT[x1(n)]+bT[x2(n)] 故该系统是非线性系统。
T[ax1(n)+bx2(n)]=ax1(n) sin(ωn)+bx2(n) sin(ωn) =aT[x1(n)]+bT[x2(n)]
故系统是线性系统。
第 1 章 时域离散信号和时域离散系统
6. 给定下述系统的差分方程, 试判定系统是否是因果稳定系统, 并说明 理由。
(1) y(n)=
1 x(Nn-1 k)
第 1 章 时域离散信号和时域离散系统
(3) 这是一个延时器, 延时器是线性非时变系统, 下面证明。 令输入为
输出为
x(n-n1)
y′(n)=x(n-n1-n0) y(n-n1)=x(n-n1-n0)=y′(n) 故延时器是非时变系统。 由于
T[ax1(n)+bx2(n)]=ax1(n-n0)+bx2(n-n0) =aT[x1(n)]+bT[x2(n)]
因此系统是非线性系统。
第 1 章 时域离散信号和时域离散系统
(6) y(n)=x(n2)
《数字信号处理(第四版)》部分课后习题解答
《数字信号处理(第四版)》部分课后习题解答一、简答题1. 什么是数字信号处理?数字信号处理(DSP)是指对数字信号进行处理和分析的一种技术。
它使用数学和算法处理模拟信号,从而实现信号的采样、量化、编码、存储和重构等过程。
DSP广泛应用于通信、音频处理、图像处理和控制系统中。
2. 数字信号处理的主要特点有哪些?•数字信号处理能够处理和分析具有广泛频谱范围的信号。
•数字信号处理能够实现高精度的信号处理和复杂的算法运算。
•数字信号处理能够实现信号的存储、传输和复原等功能。
•数字信号处理可以利用计算机等处理硬件进行实时处理和系统集成。
3. 数字信号处理的基本原理是什么?数字信号处理的基本原理是将连续时间的模拟信号转换成离散时间的数字信号,然后通过一系列的算法对数字信号进行处理和分析。
该过程主要涉及信号的采样、量化和编码等环节。
4. 什么是离散时间信号?离散时间信号是指信号的取样点在时间上呈现离散的情况。
在离散时间信号中,只能在离散时间点上获取信号的取样值,而无法观测到连续时间上的信号变化。
5. 描述离散时间信号的功率和能量的计算方法。
对于离散时间信号,其功率和能量的计算方法如下:•功率:对于离散时间信号x(n),其功率可以通过求平方和的平均值来计算,即功率P = lim(T->∞) [1/T *∑|x(n)|^2],其中T表示信号x(n)的观测时间。
•能量:对于离散时间信号x(n),其能量可以通过求平方和来计算,即能量E = ∑|x(n)|^2。
二、计算题1. 设有一个离散时间周期序列x(n) = [2, 3, -1, 4, 0, -2],求其周期N。
由于x(n)是一个周期序列,我们可以通过观察序列来确定其周期。
根据观察x(n)的取值,我们可以发现序列在n=1和n=5两个位置上取得了相同的数值。
因此,序列x(n)的周期为N = 5 - 1 = 4。
2. 设有一个信号x(t) = 2sin(3t + π/4),请将其离散化为离散时间信号x(n)。
数字信号实验第四章答案解析
数字信号处理实验报告4线性时不变离散时间系统频域分析一、实验目的通过使用matlab做实验来加强对传输函数的类型和频率响应和稳定性测试来强化理解概念。
4.1 传输函数分析回答:Q4.1 修改程序P3_1去不同的M值,当0<w<2pi时计算并画出式(2.13)所示滑动平均滤波器的幅度和相位谱,代码如下:% Program Q4_1% Frequency response of the causal M-point averager of Eq. (2.13) clear;% User specifies filter lengthM = input('Enter the filter length M: ');% Compute the frequency samples of the DTFTw = 0:2*pi/1023:2*pi;num = (1/M)*ones(1,M);den = [1];% Compute and plot the DTFTh = freqz(num, den, w);subplot(2,1,1)plot(w/pi,abs(h));gridtitle('Magnitude Spectrum |H(e^{j\omega})|')xlabel('\omega /\pi');ylabel('Amplitude');subplot(2,1,2)plot(w/pi,angle(h));gridtitle('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi');ylabel('Phase in radians');所得结果如图示:M=2M=7幅度和相位谱表现出对称性的类型是由于–冲激响应是实数,因此频率响应是周期且对称的,幅度谱是周期甚至对称的,相位响应是周期奇对称。
数字信号处理—原理、实现及应用(第4版)第2章 时域离散信号和系统的频域分析 学习要点及习题答案
·22· 第2章 时域离散信号和系统的频域分析2.1 引 言数字信号处理中有三个重要的数学变换工具,即傅里叶变换、Z 变换和离散傅里叶变换,利用它们可以将信号和系统在时域空间和频域空间相互转换,这大大方便了对信号和系统的分析和处理。
三种变换互有联系,但又不同。
表征一个信号和系统的频域特性用傅里叶变换;Z 变换是傅里叶变换的一种扩展,在Z 域对系统进行分析与设计更加既灵活方便。
单位圆上的Z 变换就是傅里叶变换,因此用Z 变换分析频域特性也很方便。
离散傅里叶变换是离散化的傅里叶变换,因此用计算机分析和处理信号时,全用离散傅里叶变换进行。
离散傅里叶变换具有快速算法FFT ,使离散傅里叶变换在应用中更加重要。
但是离散傅里叶变换不同于傅里叶变换和Z 变换,其优点是将信号的时域和频域都进行了离散化,便于计算机处理。
但实际使用中,一定要注意它的特点,例如对模拟信号进行频域分析,只能是近似的,如果使用不当,会引起较大的误差。
因此掌握好这三种变换是学习好数字信号处理的关键。
本章只学习前两种变换,离散傅里叶变换及其FFT 在下一章中讲述。
2.2 本章学习要点(1) 求序列的傅里叶变换—序列频率特性。
(2) 求周期序列的傅里叶级数和傅里叶变换—周期序列频率特性。
(3) 0(),(),(),1,cos()n N n a u n R n n δω,0sin()n ω和0j e n ω的傅里叶变换,02/ωπ为有理数。
(4) 傅里叶变换的性质和定理:傅里叶变换的周期性、移位与频移性质、时域卷积定理、巴塞伐尔定理、频域卷积定理、频域微分性质、实序列和一般序列的傅里叶变换的共轭对称性。
(5) 求序列的Z 变换及其收敛域。
(6) 序列Z 变换收敛域与序列特性之间的关系。
(7) 求逆Z 变换:部分分式法和围线积分法。
(8) Z 变换的定理和性质:移位、反转、Z 域微分、共轭序列的Z 变换、时域卷积定理、初值定理、终值定理、巴塞伐尔定理。
数字信号处理米特拉第四版实验四答案
Q4.5
The plots of the first 100 samples of the impulse responses of the two filters of Questions 4.2
3
2
1
0
-1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 /
From this plot we make the following observations: Usually, it is desirable for a filer to have an approximately linear phase in the passband, which is the same thing as an approximately constant group delay in the passband. This filter is notch filter; it is a bandstop filter with a narrow stopband centered at a normalized frequency just below 0.3. From the graph above, we see that the group delay is approximately constant over much of the passband.
M=3
Magnitude Spectrum |H(ej)| 1
0.5
0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 / Phase Spectrum arg[H(ej)]
4 2 0 -2 -4
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 /
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Laboratory Exercise 4
LINEAR, TIME-INVARIANT DISCRETE-TIME SYSTEMS: FREQUENCY-DOMAIN REPRESENTATIONS
4.1 TRANSFER FUNCTION AND FREQUENCY RESPONSE
M=3
Magnitude Spectrum |H(ej)| 1
0.5
0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 / Phase Spectrum arg[H(ej)]
4 2 0 -2 -4
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 /
I shall choose the filter of Question Q4._36__ for the following reason - It can be both causal and BIBO stable, whereas the filter of Q4.37 cannot be both because the two poles are both outside of the unit circle.
Q4.5
The plots of the first 100 samples of the impulse responses of the two filters of Questions 4.2
2
Amplitude
Phase in radians
Amplitude
Phase in radians
M=10
Magnitude Spectrum |H(ej)| 1
0.5
0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 / Phase Spectrum arg[H(ej)]
4 2 0 -2 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 /
The type of filter represented by this transfer function is - Bandpass
The difference between the two filters of Questions 4.2 and 4.3 is - The magnitude responses are the same. The phase responses might look very different to you at first,
1
Amplitude
Phase in radians
This program was run for the following three different values of M and the plots of the corresponding frequency responses are shown below:
Q4.4
The group delay of the filter specified in Question Q4.4 and obtained using the function
grpdelay is shown below:
Group Delay of H(ej) 7
6
5
4Leabharlann group delay3
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:
Magnitude Spectrum |H(ej)| 1
M=7
Magnitude Spectrum |H(ej)| 1
0.5
0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 / Phase Spectrum arg[H(ej)]
4 2 0 -2 -4
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 /
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) for 0 2 is shown below:
Amplitude
0.5
Phase in radians
0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 / Phase Spectrum arg[H(ej)]
2
1
0
-1
-2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 /
Q4.3
4 2 0 -2 -4
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 /
The types of symmetries exhibited by the magnitude and phase spectra are due to - The impulse response is real. Therefore, the frequency response is periodically conjugate symmetric, the magnitude response is periodically even symmetric, and the phase response is periodically odd symmetric. The type of filter represented by the moving average filter is - This is a lowpass filter. The results of Question Q2.1 can now be explained as follows – It is a lowpass filter. The input was a sum of two sinusoids, one high frequency and one low frequency. The particular results depend on the filter length M, but the general result is that the higher frequency sinusoidal input component is attenuated more than the lower frequency sinusoidal input component.
The type of filter represented by this transfer function is - Bandpass
The plot of the frequency response of the causal LTI discrete-time system of Question Q4.3
% Program Q4_1 % Frequency response of the causal M-point averager of Eq. (2.13) clear; % User specifies filter length M = input('Enter the filter length M: '); % Compute the frequency samples of the DTFT w = 0:2*pi/1023:2*pi; num = (1/M)*ones(1,M); den = [1]; % Compute and plot the DTFT h = freqz(num, den, w); 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');
4
but they are actually similar. The phase response of the second filter exhibits a branch cut of the arctangent function at normalized frequency 0.4, which is right in the middle of the passband. However, the unwrapped phase would not show this discontinuity. Both filters have an approximately linear phase in the passband and their group delays are approximately the negatives of one another. However, the two filters have different poles. The poles of the first filter are INSIDE the unit circle, whereas those of the second filer are OUTSIDE the unit circle. Thus, in a causal implementation, the first filter would be BIBO STABLE, whereas the second filter would be UNSTABLE. Therefore, in most applications the second filter would be preferable.