Home > freetb4matlab > signal > buttord.m

buttord

PURPOSE ^

% Compute butterworth filter order and cutoff for the desired response

SYNOPSIS ^

function [n, Wc] = buttord(Wp, Ws, Rp, Rs)

DESCRIPTION ^

% Compute butterworth filter order and cutoff for the desired response
% characteristics. Rp is the allowable decibels of ripple in the pass 
% band. Rs is the minimum attenuation in the stop band.
%
% [n, Wc] = buttord(Wp, Ws, Rp, Rs)
%     Low pass (Wp<Ws) or high pass (Wp>Ws) filter design.  Wp is the
%     pass band edge and Ws is the stop band edge.  Frequencies are
%     normalized to [0,1], corresponding to the range [0,Fs/2].
% 
% [n, Wc] = buttord([Wp1, Wp2], [Ws1, Ws2], Rp, Rs)
%     Band pass (Ws1<Wp1<Wp2<Ws2) or band reject (Wp1<Ws1<Ws2<Wp2)
%     filter design. Wp gives the edges of the pass band, and Ws gives
%     the edges of the stop band.
%
% Theory: |H(W)|^2 = 1/[1+(W/Wc)^(2N)] = 10^(-R/10)
% With some algebra, you can solve simultaneously for Wc and N given
% Ws,Rs and Wp,Rp.  For high pass filters, subtracting the band edges
% from Fs/2, performing the test, and swapping the resulting Wc back
% works beautifully.  For bandpass and bandstop filters this process
% significantly overdesigns.  Artificially dividing N by 2 in this case
% helps a lot, but it still overdesigns.
%
% See also: butter

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003