实 验 报 告 课 程: 数字信号处理 专业班级: 学生姓名: 学 号: 年 月 日 2.1 对M=2,运行上述程序,生成输入x[n]=s1[n]+s2[n]的输出信号。输入x[n]的哪个分量被该离散时间系统抑制? % 程序 P2_1 % 一个 M 点滑动平均滤波器的仿真 % 产生输入信号 n = 0:100; s1 = cos(2*pi*0.05*n); % 一个低频正弦 s2 = cos(2*pi*0.47*n); % 一个高频正弦 x = s1+s2; % M 点滑动平均滤波器的实现 M = input('滤波器所需的长度 = '); num = ones(1,M); y = filter(num,1,x)/M; clf; subplot(2,2,1); plot(n, s1); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('低频正弦'); subplot(2,2,2); plot(n, s2); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('高频正弦'); subplot(2,2,3); plot(n, x); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('输入信号'); subplot(2,2,4); plot(n, y); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('输出信号'); axis; 图形显示如下: 答:输入部分 nx的高频成分 nx2成分被抑制了。 2.3 对滤波器长度 M 和正弦信号 s1[n]和 s2[n]的频率取其他值,运行程序 P2.1,算出结果。 n = 0:100; s1=cos(2*pi*0.02*n); s2=cos(2*pi*0.46*n); x = s1+s2; % M 点滑动平均滤波器的实现 M = input('滤波器所需的长度 = '); num = ones(1,M); y = filter(num,1,x)/M; clf; figure, subplot(2,2,1); plot(n, s1); axis([0, 100, -2, 2]); xlabel('时间序号 n'); ylabel('振幅'); title('低频正弦'); subplot(2,2,2); plot(n, s2); axis([0, 100, -2, 2]); xlabel('时间序号 n'); ylabel('振幅'); title('高频正弦'); subplot(2,2,3); plot(n, x); axis([0, 100, -2, 2]); xlabel('时间序号 n'); ylabel('振幅'); title('输入信号'); subplot(2,2,4); plot(n, y); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('输出信号'); axis; num =[1,-ones(1,M-1)]; y = filter(num,1,x)/M; figure, subplot(2,2,1); plot(n, s1); axis([0, 100, -2, 2]); xlabel('时间序号n'); ylabel('振幅'); title('低频正弦'); su...