📄 c8ex12.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -