Home > freetb4matlab > signal > kaiserord.m

kaiserord

PURPOSE ^

% error: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])

SYNOPSIS ^

function [n, w, beta, ftype] = kaiserord(f, m, dev, fs)

DESCRIPTION ^

% error: [n, Wn, beta, ftype] = kaiserord(f, m, dev [, fs])
%
% Returns the parameters needed for fir1 to produce a filter of the
% desired specification from a kaiser window:
%       n: order of the filter (length of filter minus 1)
%       Wn: band edges for use in fir1
%       beta: parameter for kaiser window of length n+1
%       ftype: choose between pass and stop bands
%       b = fir1(n,Wn,kaiser(n+1,beta),ftype,'noscale');
%
% f: frequency bands, given as pairs, with the first half of the
%    first pair assumed to start at 0 and the last half of the last
%    pair assumed to end at 1.  It is important to separate the
%    band edges, since narrow transition regions require large order
%    filters.
% m: magnitude within each band.  Should be non-zero for pass band
%    and zero for stop band.  All passbands must have the same
%    magnitude, or you will get the error that pass and stop bands
%    must be strictly alternating.
% dev: deviation within each band.  Since all bands in the resulting
%    filter have the same deviation, only the minimum deviation is
%    used.  In this version, a single scalar will work just as well.
% fs: sampling rate.  Used to convert the frequency specification into
%    the [0, 1], where 1 corresponds to the Nyquist frequency, fs/2.
%
% The Kaiser window parameters n and beta are computed from the
% relation between ripple (A=-20*log10(dev)) and transition width 
% (dw in radians) discovered empirically by Kaiser:
%
%           / 0.1102(A-8.7)                        A > 50
%    beta = | 0.5842(A-21)^0.4 + 0.07886(A-21)     21 <= A <= 50
%           \ 0.0                                  A < 21
%
%    n = (A-8)/(2.285 dw)
%
% Example
%    [n, w, beta, ftype] = kaiserord([1000,1200], [1,0], [0.05,0.05], 11025);
%    freqz(fir1(n,w,kaiser(n+1,beta),ftype,'noscale'),1,[],11025);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003