function [B,A] = boost2(fs, fc, bw, gain); %BOOST - Design a boost filter at given gain, center % frequency fc, bandwidth bw, and sampling rate fs % (default = 1). % % Cookbook formulae for audio EQ biquad filter coefficients % by Robert Bristow-Johnson Q = fs/bw; w0 = 2*pi*fc/fs; A=sqrt(gain); alpha = sin(w0)/(2*Q) b0 = 1 + alpha*A b1 = -2*cos(w0) b2 = 1 - alpha*A a0 = 1 + alpha/A a1 = -2*cos(w0) a2 = 1 - alpha/A A = [a0 a1 a2] / a0; B = [b0 b1 b2] / a0; if nargout==0 freqz(B,A); title('Boost Frequency Response') end