You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 lines
371 B

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