zoom/pc/data/20090722/makenotch.m

14 lines
371 B
Mathematica
Raw Permalink Normal View History

function [b,a] = makenotch(Fs, W0, BandWidth)
Fn = Fs/2; % Nyquist freq [Hz]
w0 = W0*pi/Fn; % notch frequency normalized
B = BandWidth*pi/Fn; % normalized bandwidth
k1 = -cos(w0); k2 = (1 - tan(B/2))/(1 + tan(B/2));
b = [1+k2 2*k1*(1+k2) 1+k2];
a = [2 2*k1*(1+k2) 2*k2];
#figure(1); % look at the frequency response of your filter
#freqz(b,a);
# now filter(b,a,input)