Files
matlab/equalizer/boost2.m
T
jens 1f5b0b0570 - added
git-svn-id: http://moon:8086/svn/matlab/trunk@128 801c6759-fa7c-4059-a304-17956f83a07c
2020-07-23 11:10:12 +00:00

30 lines
610 B
Matlab

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 <rbj@audioimagination.com>
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