### FIR Example

An example sinewave input signal is shown in Fig.5.12, and the output of a length FIR ``running sum'' filter is shown in Fig.5.12. These signals were computed by the following matlab code:Nx = 1024; % input signal length (nonzero portion) Nh = 128; % FIR filter length A = 1; B = ones(1,Nh); % FIR "running sum" filter n = 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 signalWe 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 to zero.

Since the coefficients of an FIR filter are also its nonzero impulse response samples, we can say that the duration of the transient response equals the length of the impulse response minus one. For Infinite Impulse Response (IIR) filters, such as the recursive comb filter analyzed in Chapter 3, the transient response decays

*exponentially*. This means it is never really completely finished. In other terms, since its impulse response is infinitely long, so is its transient response, in principle. However, in practice, we treat it as finished for all practical purposes after several time constants of decay. For example, seven time-constants of decay correspond to more than 60 dB of decay, and is a common cut-off used for audio purposes. Therefore, we can adopt as the definition of

*decay time*(or ``

*ring time*'') for typical audio filters. See [84]

^{6.5}for a detailed derivation of and related topics. In summary, we can say that the transient response of an audio filter is over after seconds, where is the time it takes the filter impulse response to decay by dB.

**Next Section:**

IIR Example

**Previous Section:**

FIR Software Implementations