Figure 3.8 plots the impulse response of the example filter, as computed by the matlab script shown in Fig.3.9. (The plot-related commands are also included for completeness.4.2) The impulse signal consists of a single sample at time 0 having amplitude 1, preceded and followed by zeros (an ideal ``click'' at time 0). Linear, time-invariant filters are fully characterized by their response to this simple signal, as we will show in Chapter 4.
% Example comb filter: g1 = 0.5^3; B = [1 0 0 g1]; % Feedforward coeffs g2 = 0.9^5; A = [1 0 0 0 0 g2]; % Feedback coefficients h = filter(B,A,[1,zeros(1,50)]); % Impulse response % h = impz(B,A,50); % alternative in octave-forge or MSPTB % Matlab-compatible plot: clf; figure(1); stem([0:50],h,'-k'); axis([0 50 -0.8 1.1]); ylabel('Amplitude'); xlabel('Time (samples)'); grid; cmd = 'print -deps ../eps/eir.eps'; disp(cmd); eval(cmd);
The impulse response of this filter is also easy to compute by hand. Referring to the difference equation
Software Implementation in Faust