2 function [num, den] =
iirpeak(Wo, BW, varargin)
3 %IIRPEAK Second-order IIR peaking (resonator) digital filter design.
4 % [NUM, DEN] = IIRPEAK(Wo, BW) designs a second-order resonator digital
5 % filter with the peak at frequency Wo and a bandwidth of BW at the 3 dB
6 % level. Wo must satisfy 0.0 < Wo < 1.0, with 1.0 corresponding to pi
9 % The bandwidth BW is related to the Q-factor of a filter by BW = Wo/Q.
11 % [NUM, DEN] = IIRPEAK(Wo, BW, Ab) designs a peaking filter with a bandwidth
12 % of BW at a level Ab in decibels. If not specified, Ab defaults to the
13 % 3 dB width (10*log10(2)).
16 % % Design a filter operating at a rate of 10 kHz that has a peak at
17 % % 1.75 kHz and a 3 dB width of 500 Hz.
18 % Fs = 10000; Wo = 1750/(Fs/2); BW = 500/(Fs/2);
22 % See also IIRNOTCH, IIRCOMB, FIRGR.
24 % Author(s): P. Pacheco
25 % Copyright 1999-2006 The MathWorks, Inc.
26 % $Revision: 1.1.4.4 $ $Date: 2007/12/14 14:34:01 $
29 % [1] Sophocles J. Orfanidis, Introduction To Signal Processing
34 % Validate input arguments.
37 error(generatemsgid(
'FilterErr'), msg);
40 % Design a peaking filter.
46 % Design a 2nd order IIR peaking (resonator) digital filter.
48 % Inputs are normalized by pi.
53 beta = (Gb/sqrt(1-Gb.^2))*tan(BW/2);
56 num = (1-gain)*[1 0 -1];
57 den = [1 -2*gain*cos(Wo) (2*gain-1)];