function a=M_fq2coef(f,q,fs)
% function a = fq2coef(f,q,fs)
% convert frequency and q to coefficients for a second order
% filter.  
% fs is (optional) sampling rate (default 44100).
% returns standard filter vector a (see filter and freqz)

% a(1) = 1 always for complex second order roots
a(1)=1;

if nargin == 2
  fs=44100;
end;

T = 1/fs;
B = f/q;
r = exp( -pi * B * T );
theta = 2 * pi * f / fs;
a(2) = -2 * r * cos(theta);
a(3) = r^2;