kaiserord() - Signal Processing
kaiserord returns a filter order n and beta parameter
to specify a Kaiser window for use with the fir1 function.
Given a set of specifications in the frequency domain, kaiserord estimates
the minimum FIR filter order that will approximately meet the specifications. kaiserord converts
the given filter specifications into passband and stopband ripples
and converts cutoff frequencies into the form needed for windowed
FIR filter design.[n,Wn,beta,ftype] = kaiserord(f,a,dev) finds
the approximate order n, normalized frequency band
edges Wn, and weights that meet input specifications f, a,
and dev. f is a vector of band
edges and a is a vector specifying the desired
amplitude on the bands defined by f. The length
of f is twice the length of a,
minus 2. Together, f and a define
a desired piecewise constant response function. dev is
a vector the same size as a that specifies the
maximum allowable error or deviation between the frequency response
of the output filter and its desired amplitude, for each band. The
entries in dev specify the passband ripple and
the stopband attenuation. You specify each entry in dev as
a positive number, representing absolute filter gain (not in decibels).Note
If, in the vector dev, you specify unequal
deviations across bands, the minimum specified deviation is used,
since the Kaiser window method is constrained to produce filters with
minimum deviation in all of the bands.fir1 can use the resulting
order n, frequency vector Wn,
multiband magnitude type ftype, and the Kaiser
window parameter beta. The ftype string
is intended for use with fir1;
it is equal to 'high' for a highpass filter and 'stop' for
a bandstop filter. For multiband filters, it can be equal to 'dc-0' when
the first band is a stopband (starting at f = 0) or 'dc-1' when
the first band is a passband.To design an FIR filter b that approximately
meets the specifications given by kaiser parameters f, a,
and dev, use the following command.b = fir1(n,Wn,kaiser(n+1,beta),ftype,'noscale')
[n,Wn,beta,ftype] = kaiserord(f,a,dev,fs) uses
a sampling frequency fs in Hz. If you don't specify
the argument fs, or if you specify it as the empty
vector [], it defaults to 2 Hz,
and the Nyquist frequency is 1 Hz. You can use this
syntax to specify band edges scaled to a particular application's
sampling frequency. The frequency band edges in f must
be from 0 to fs/2.c = kaiserord(f,a,dev,fs,'cell') is
a cell-array whose elements are the parameters to fir1.Note
In some cases, kaiserord underestimates or
overestimates the order n. If the filter does not
meet the specifications, try a higher order such as n+1, n+2,
and so on, or a try lower order.Results are inaccurate if the cutoff frequencies are near 0
or the Nyquist frequency, or if dev is large (greater
than 10%).
Syntax
[n,Wn,beta,ftype] = kaiserord(f,a,dev)[n,Wn,beta,ftype] = kaiserord(f,a,dev,fs)c = kaiserord(f,a,dev,fs,'cell')
Example
b = fir1(n,Wn,kaiser(n+1,beta),ftype,'noscale')
Output / Return Value
Limitations
Alternatives / See Also
Reference