= 0:Nx-1; x = sin(n*2*pi*7/Nx); % input sinusoid - zero-pad it: zp=zeros(1,Nx/2); xzp=[zp,x,zp]; nzp=[0:length(xzp)-1]; y = filter(B,A,xzp); % filtered output signal We know that the transient response must end samples after the input sinewave switches on, and the decay-time lasts the same amount of time after the input signal switches back