0001 function [B,A] = nt_filter_peak(Wo,Q)
0002
0003
0004
0005
0006
0007
0008
0009 if nargin<2; error('!'); end
0010 if Wo>1; error('normalized centre frequency should be < 1'); end
0011
0012 BW=Wo/Q;
0013
0014
0015 BW = BW*pi;
0016 Wo = Wo*pi;
0017
0018 gain = 1/(1+tan(BW/2));
0019 B = (1-gain)*[1 0 -1];
0020 A = [1 -2*gain*cos(Wo) (2*gain-1)];
0021
0022 if ~nargout
0023 figure(100);
0024 freqz(B,A);
0025 figure(101);
0026 plot([-10:100],filter(B,A,[zeros(10,1);1;zeros(100,1)]));
0027 xlabel('s / sr');
0028 end
0029