When I try to use subplot to show impulse response and unit step response in the same figure, the impulse response plot displays incorrectly. Any idea why subplot is not plotting both the impulse response and unit step response appropriately? Uncomment the second section of code to see the problem. Thanks!
a = [1,-1,0.9]; b = [1]; n = [-20:120]; h = impz(b,a,n); subplot(1,2,1); stem(n,h); title('Impulse response'); xlabel('n'); ylabel('h(n)'); % %Plot unit step response ex. 2.11 b
% x = stepseq(0,-20,120);
% a1 = [1,-1,0.9]; b1 = [1];
% s = filter(b1,a1,x);
% n1 = [-20:120];
% subplot(1,2,2); stem(n1,s);
% title('Step response'); xlabel('n'); ylabel('s(n)');
Best Answer