オールパスフィルター(双二次) / Biquad Allpass Filter

function [B,A] = biquad_apf(fc, q, fs)
% BIQUAD_APF   biquad all-pass filter
%    [B,A] = biquad_apf(fc, q, fs)
%
% Input:
%    fc - center frequency (Hz)
%     q - Q-factor
%    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)/(2*q);

B = [
  1 - alpha
 -2 * cos(omega)
  1 + alpha
];

A = [
   1 + alpha
  -2 * cos(omega)
   1 - alpha
];



MARUI Atsushi
2017-02-22