
git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7711 ddd99763-3ecb-0310-9145-efcb8ce7c51f
14 lines
371 B
Matlab
14 lines
371 B
Matlab
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) |