Discrete-time, overlap-add, FIR filter
This object uses the overlap-add method of block FIR filtering, which is very efficient for streaming data.
Hd = dfilt.fftfir(b,len) returns a discrete-time, FFT, FIR filter, Hd, with numerator coefficients, b and block length, len. The block length is the number of input points to use for each overlap-add computation.
Note When you use a dfilt.fftfir object to filter data, the filter always operates on a segment of the signal equal in length to an integer multiple of the object's block length, len. If the input signal length is not equal to an integer multiple of the block length, the signal length is truncated to the nearest integer satisfying this requirement. If the PersistentMemory property is set to true, the next time you use the filter object the remaining signal samples are prepended to the subsequent input. The resulting number of FFT points = (filter length + the block length - 1). The filter is most efficient if the number of FFT points is a power of 2.
The fftfir uses an overlap-add block processing algorithm, which is represented as follows,
where len is the block length and M is the length of the numerator-1, (length(b)-1), which is also the number of states. The output of each convolution is a block that is longer than the input block by a tail of (length(b)-1) samples. These tails overlap the next block and are added to it. The states reported by dfilt.fftfir are the tails of the final convolution.
Create an FFT FIR discrete-time filter with coefficients from a 30th order lowpass equiripple design:
b = firpm(30,[0 .1 .2 .5]*2,[1 1 0 0]); Hd = dfilt.fftfir(b)
To view the frequency domain coefficients used in the filtering, use the following command.
freq_coeffs = fftcoeffs(Hd);