% % Filename: example18.m % % Description: M-file demonstrating matlab's discrete-time system % response functions dimpuls() and dstep(). % n = 0:10; % discrete-time values h = 2*(-0.5).^n; % computed unit-pulse response y = (1/1.5)*(-0.5).^n + (2/1.5);% computed unit-step response subplot(2,2,1); stem(n,h,'filled'); % plot unit-pulse response xlabel('n'); ylabel('h[n]'); title('Unit-Pulse Response by Hand'); subplot(2,2,2); stem(n,y,'filled'); % plot unit-step response xlabel('n'); ylabel('y[n]'); title('Unit-Step Response by Hand'); clear; a = 0.5; b = 2.0; n = 0:10; numH = [b 0]; denH = [1 a]; % H(z) = bz/(z+a) printsys(numH,denH,'z'); % print TF to check h = dimpulse(numH,denH,n); % determine unit-impulse response y = dstep(numH,denH,n); % determine unit-step response subplot(2,2,3); stem(n,h,'filled'); % plot unit-pulse response xlabel('n'); ylabel('h[n]'); title('Unit-Pulse Response by Matlab'); subplot(2,2,4); stem(n,y,'filled'); % plot unit-step response xlabel('n'); ylabel('y[n]'); title('Unit-Step Response by Matlab');MATLAB Plot Generated: