c8ex12.m
来自「数字信号处理Matlab实现?中藕糯鞰atlab实现数字信号处理Matlab」· M 代码 · 共 29 行
M
29 行
x = [1 2 2 1 1]; % Define samples of xh = [3 2 1]; % Define samples of hy = conv(x,h); % Convolve x and h% Format for plot.nz = 2; % Extra zeros on yly = length(y)+nz; % Length of yxz = [x,zeros(1,ly-length(x))]; % Zero pad xhz = [h,zeros(1,ly-length(h))]; % Zero pad hyz = [y,zeros(1,nz)]; % Zero pad ynn = 0:ly-1; % Establish x-axis indices% Now plot the results.subplot(2,2,1) % Top left plotstem(nn,xz) % Plot x as discrete sequencexlabel('Samplex Index - n') % Label x axisylabel('x(nT)') % Label y axissubplot(2,2,2) % Top right plotstem(nn,hz) % Plot h as discrete sequencexlabel('Sample Index - n') % Label x axisylabel('h(nT)') % Label y axissubplot(2,2,3) % Bottom left plotstem(nn,yz) % Plot y as discrete sequencexlabel('Sample Index - n') % Label x axisylabel('y(nT)') % Label y axis
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?