悬赏50分,求一段MATLAB程序的解释

来源:百度知道 编辑:UC知道 时间:2024/09/23 19:19:31
求助各位高手
以下是MATLAB的一段程序,有关数字信号处理仿真方面的程序,求每行语句的解释,并且根据根据此段程序编一道题目
先谢谢各位了

% Program P2_7
clf;
h = [3 2 1 -2 1 0 -4 0 3];
% impulse response
x = [1 -2 3 -4 3 2 1];

% input sequence
y = conv(h,x);
n = 0:14;
subplot(2,1,1);
stem(n,y);
xlabel('Time index n'); ylabel('Amplitude');
title('Output Obtained by Convolution'); grid;
x1 = [x zeros(1,8)];
y1 = filter(h,1,x1);
subplot(2,1,2);
stem(n,y1);
xlabel('Time index n'); ylabel('Amplitude');
title('Output Generated by Filtering'); grid;

clf;%清空以上的file
h = [3 2 1 -2 1 0 -4 0 3];%创建多项式并用赋给h 降幂排列的,,是3*x^8+2*x^7+1*x^6+(-2)*x^5+1*x^4+(-4)*x^2+3
% impulse response
x = [1 -2 3 -4 3 2 1];%这个同上的方法

% input sequence
y = conv(h,x);%函数conv()用于求两个多项式的乘积多项式
n = 0:14;%n是0到14的区间
subplot(2,1,1);%将当前窗口分割成为2行,1列,并在其中的第1个区域绘图
stem(n,y);%Stem函数用来实现离散序列图的绘制 横坐标n个点,,依次值为y
xlabel('Time index n'); ylabel('Amplitude');%给x轴添标注 给y轴添标注
title('Output Obtained by Convolution'); grid;%title给图形加标题 grid加网格
x1 = [x zeros(1,8)];%一行为8个0的矩阵
y1 = filter(h,1,x1);用filter求零输入响应 零状态响应 h和1都为矢量就是你以上提到的往里带

subplot(2,1,2);%将当前窗口分割成为2行,1列,并在其中的第2个区域绘图
stem(n,y1);%同上
xlabel('Time index n'); ylabel('Amplitude');%同上
title('Output Generated by Filtering'); grid;%同上

clf 清除图对象

conv 多项式乘、卷积

subplot 创建子图

stem 二维杆图

xlabel x轴名称

title 图名

grid 画分格线

fi