Browse Source

add makenotch script

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7711 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
nilm 15 years ago
parent
commit
a1d4b342a4
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      pc/data/20090722/makenotch.m

+ 14
- 0
pc/data/20090722/makenotch.m View File

@@ -0,0 +1,14 @@
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)

Loading…
Cancel
Save