remezFIRFilter(numTaps, sampFreq, bands)

import signals.filters.tfilter-1

Design a FIR filter with the Remez algorithm.

import signals.filters.tfilter-1;
Design filter
filter=remezFIRFilter(0, 2 kHz, [ { gain: 1, // passband ripple: 5dB, start: 0Hz, stop: 400Hz }, { gain: 0, // stopband atten: -40dB, start: 500Hz, stop: 1000Hz } ]); filter=remezFIRFilter(0, 2 kHz, [ { gain: 0, // stopband atten: -40dB, start: 0Hz, stop: 400Hz }, { gain: 1, // passband ripple: 5dB, start: 500Hz, stop: 1000Hz } ]); filter=remezFIRFilter(0, 2 kHz, [ { gain: 0, // stopband atten: -40dB, start: 0Hz, stop: 200Hz }, { gain: 1, // passband ripple: 5dB, start: 300Hz, stop: 500Hz }, { gain: 0, // stopband atten: -40dB, start: 600Hz, stop: 1000Hz }, ]); filter=remezFIRFilter(0, 2 kHz, [ { gain: 1, // passband ripple: 5dB, start: 0Hz, stop: 200Hz }, { gain: 0, // stopband atten: -40dB, start: 300Hz, stop: 500Hz }, { gain: 1, // passband ripple: 5dB, start: 600Hz, stop: 1000Hz }, ]); filter.plot()
numTapsthe number of taps wanted. If 0 or null, the smallest number of taps will be used.
sampFreqthe sample frequency.
bandsthe band specification array.
return valuelinear system container (TransferFunction).

If num_taps is zero or null, algorithm will try to find the minimal suitable tap number.

Bands are specified by the ibands argument. It is a list of frequency specifications. Every element is an object with the following fields:

You should leave a gap (transition band) between the specified bands, otherwise the filter will not be realizable and the algorithm will not converge.

You can use arbitary number of bands.

It returns a signals.containers-1/TransferFunction structure.

import signals.filters.tfilter-1;
Get number of taps
filter.num.length
import signals.filters.tfilter-1;
Get taps
filter.num
Based on TFilter (http://t-filter.appspot.com).

For further details on FIR filters, see http://en.wikipedia.org/wiki/Finite_impulse_response.

Read more about the Remez algorithm at http://en.wikipedia.org/wiki/Remez_algorithm.