function [B,A] = biquad_notch(fc, bw, fs) %BIQUAD_NOTCH Biquad notch filter % [B,A] = biquad_notch(fc, bw, fs) % % Input: % fc - cutoff frequency (Hz) % bw - bandwidth in octaves (between -3dB frequencies) % fs - sampling frequency (Hz) % % 2010-01-18 by MARUI Atsushi % based on "Cookbook formulae for audio EQ biquad filter % coefficients" by Robert Bristow-Johnson. omega = 2 * pi * fc / fs; alpha = sin(omega) * sinh(log(2) / 2 * bw * omega / sin(omega)); B = [ 1 -2 * cos(omega) 1 ]'; A = [ 1 + alpha -2 * cos(omega) 1 - alpha ]';