1、(1)程序代码 “.m”文件内容如下:N=12;M=4;n=0:2*N-1;Xm=sin(2*pi*M*n/N);subplot(4,2,1);stem(n,Xm);xlabel(n);ylabel(x4(n)M=5;subplot(4,2,3);x5(n)M=7;subplot(4,2,5);x7(n)M=10;subplot(4,2,7);x10(n)subplot(4,2,2);plot(n,Xm);subplot(4,2,4);subplot(4,2,6);subplot(4,2,8);仿真图如下 由上图可看出,当M=4时,最小整数周期T=3;M=5时,T=12;M=7时,T=12;M
2、=10时,T=6;所以当M=4时,得到的最小整数周期为3。 题中信号x(n)=sin(2Mn/N)的频率w=2M/N,由公式得周期T=2k/w,有T=kN/M(k=1,2,.)。当N/M为正整数时,最小周期T=N/M;当N/M为有理数时,不管MN或者MN,都有最小周期T=N;当N/M为无理数时,该序列不是周期序列。(2) 程序代码“.m”文件内容如下:k=1;9;w=2*pi*k/5;x=sin(w*n);subplot(2,2,1);stem(n,x);x1(n) k=2;subplot(2,2,2);x2(n)k=4;subplot(2,2,3);k=6;subplot(2,2,4);x6
3、(n)仿真图如下由上图可看出有三种不同的信号,当k=1和k=6的仿真结果是一样的,k=2与k=4是另外二种。为什么不同的k 值可以得到相同的信号呢?因为k=2k/5,又T=2/k,得信号的最小周期Tmin=5。当k=1和k=6时,两个信号刚好相差一个周期,可看做两个信号的周期是一样的,所以两个信号相同。Experiment 1.2 Discrete Time Domain System Analysis(1) Calculation of discrete-time convolution(2) Determine the linearity and shift-invariance of t
4、he systems.2. Content2.1 Calculation of discrete-time convolution(1) Calculate the convolutions of the following signals with conv. Draw the curves of x(n), h(n) and y(n) ( x(n)* h(n) respectively.(2) Consider x(n) = 0.5n u(n)h(n)= u(n)If calculate y(n)=x(n)*h(n) with conv , the problem of infinite
5、lengths of x(n) and h(n) should be solved. Save the x(n) in the range of 0n24 in vector x, the h(n) in the range of 0n14 in vector h, the result conv(h,x) in vector y. Draw the y(n) with stem, comparing with 0.5n u(n)* u(n), please point out which values are true and which values are false.2.2 Deter
6、mine the linearity and shift-invariance of the systemsConsider the following three systemsSystem1: w(n)=x(n)-x(n-1)-x(n-2)System2: y(n)=cos(x(n)System3: z(n)=nx(n)where x(n) is the input, w(n) ,y(n) and z(n) are the outputs. (1) Consider the three input signalsx1(n)=(n)x2(n)=(n-1)x3(n)=(n)+2(n-1)the
7、 output of system1 are stored respectively in vectors w1, w2 and w3(0n5). Draw the curves of w1, w2, and w1+2w2 in one graph. (2) Repeat (1) with system2.(3) Repeat (1) with system3.(4) Which of the systems is the linear and shift invariant system?(1) Give the M files and the figures.(2) Answer the
8、question.1.2.1(1) 代码如下:n=0:14;x=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1; h=0.8.n;y=conv(x,h)ny=length(y);n1=0:ny-1;subplot(3,1,1);x(n)subplot(3,1,2);stem(n,h);h(n) subplot(3,1,3);stem(n,y);y(n)仿真图如下:程序代码如下:9;x=1,1,1,1,1,1,1,1,1,1;19;h=0.5*sin(0.5*n1);y=conv(x,h);n2=0:stem(n1,h);subplot(3,1,3);stem(n2,y);(2) x
9、(n) = 0.5n u(n),0n24; h(n)= u(n), 0n14; 计算其卷积为y(n)。 程序如下:24;x=0.5*n;h=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;0.5n u(n)*u(n)的程序如下:200;h=ones(1,201);问题:与0.5n u(n)* u(n)作比较, 指出上图中哪些是错误的,哪些是正确的? 答:n越大则卷积的结果越准确,n的数量取得较少时结果会有一定的误差。图中y(n)在0n15时(前部分)是正确的,而在后部分16n39之间出现了一定的误差。1.2.2(1) System1: 程序如下: Functionx,n=impse
10、q(n0,n1,n2) n=n1:n2;x=(n-n0)=0; End5;w1=impseq(0,0,5)-impseq(1,0,5)-impseq(2,0,5);w2=impseq(1,0,5)-impseq(2,0,5)-impseq(3,0,5);w3=impseq(0,0,5)+2*impseq(1,0,5)-impseq(1,0,5)-2*impseq(2,0,5)-impseq(2,0,5)-2*impseq(3,0,5);subplot(4,1,1);stem(n,w1);w1subplot(4,1,2);stem(n,w2);w2subplot(4,1,3);stem(n,w3
11、);w3subplot(4,1,4);stem(n,w1+2*w2);w1+2*w2(2)System2: y(n)=cos(x(n) 程序如下:x1=impseq(0,0,5);x2=impseq(1,0,5);x3=impseq(0,0,5)+2*impseq(1,0,5);y1=cos(double(x1);y2=cos(double(x2);y3=cos(double(x3);stem(n,y1);y1(n)stem(n,y2);y2(n)stem(n,y1+2*y2);y3(n)(3) System3:程序如下: z1=n*diag(x1); z2=n*diag(x2); z3=n*
12、diag(x3);stem(n,z1);z1stem(n,z2);z2stem(n,z3);z3stem(n,z1+2*z2);z1+2*z2哪些系统是线性的?哪些不是?System1是线性移不变系统,System2是非线性移不变系统,System3是线性移变系统。Experiment 1.3 Frequency domain system analysis 1. Purposes(1) Be familiar with the frequency characteristics of discrete-time systems.(2) Learn to analyze systems in
13、analog domain and digital domain by a computer.1 Consider the system H(Z)=Z/(Z-A) , analyzing the amplitude spectrum and the phase spectrum of in the range 04 when (1) A= 0.5; (2) A= -0.5; (3) A= 02 Analyzing the amplitude spectrum of H(j)in the range 02.3 Design the DF and analyze the amplitude spe
14、ctrum in the range 02.(1) The prototype is as above, assume the sampling interval Ts is 0.5s, determine the digital filter H1(z) with impulse invariance method.(2) Assume the sampling interval Ts is 0.1s. Repeat (1) and obtain the digital filter H2(z).(3) Plot H1(z) and H2(z) in the same graph with
15、subplot.1 Calculate H1(z) and H2(z);2 Give the M files and the figures.1.3.2(1) system H(Z)=Z/(Z-A),其相位的取值范围04 。A=0.5;k=0:2000;w=(pi/500)*k;H=exp(j*w)./(exp(j*w)-A);magH=abs(H);angH=angle(H);subplot(3,2,1);plot(w/pi,angH);title(相位响应相位/pi以pi为单位的频率 subplot(3,2,2);plot(w/pi,magH);幅度响应幅度/piA=-0.5; subpl
16、ot(3,2,3); subplot(3,2,4);A=0; subplot(3,2,5); subplot(3,2,6);(2) , 分析其振幅特性H(j),其中的取值范围02。1000;H=2./(3+4*(j*w)+(j*w).2);subplot(1,1,1);plot(w,magH);(3) H1(z)为T=0.5s时的输出,H2(z)为T=0.1s时的输出,两函数的幅度响应和相位相应 程序如下:1:w=pi*k/100;H1=exp(j*w)./(exp(j*w)-exp(-0.5)-exp(j*w)./(exp(j*w)-exp(-3*0.5);H2=exp(j*w)./(exp
17、(j*w)-exp(-0.1)-exp(j*w)./(exp(j*w)-exp(-3*0.1);magH1=abs(H1);magH2=abs(H2);bh1=angle(H1);bh2=angle(H2);plot(w/pi,magH1);幅度响应H1(Z)以/pi为单位的频率幅度subplot(3,2,3);plot(w/pi,bh1);相位响应H1(Z)相位/pisubplot(3,2,2);plot(w/pi,magH2);幅度响应H2(Z)subplot(3,2,4);plot(w/pi,bh2);相位响应H2(Z)H3=2*(3+4*j*w-w.*w).-1;magH3=abs(H3);angH3=angle(H3);subplot(3,2,5);plot(w/pi,magH3);模拟滤波器幅度特性grid;以为单位的频率subplot(3,2,6);plot(w/pi,angH3);模拟滤波器相位特性相位/pi 计算出H1(z) and H2(z).根据设计出来的滤波器,所得函数H1(z)=0.164*z/(z2-1.646*z+0.6706) H2(z)=0.384*z/(z2-0.83*z+0
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2