# notchStart - Create output vector omega_notch=0.2441*pi and...

This preview shows page 1. Sign up to view the full content.

% % notchfilter.m % Douglas L. Jones % University of Illinois % January 9, 2009 % % notchfilter.m: implements a second-order IIR notch filter % of specified frequency and % to remove interference and recover calls of each species % % INPUTS % - x signal to be filtered % - omega_notch frequency in radians to notch % - pole_mag magnitude of the notch-filter pole % % OUTPUTS % -y filtered data % %y = notchfilter(x,omega_notch,pole_mag) % function [y] = notchfilter(x,omega_notch,pole_mag) % % SETUP % % Set parameters xlen = length(x); y = zeros(size(x));
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Create output vector % omega_notch=0.2441*pi and pole_mag=0.98 % Compute coefficients of notch filter a1 =pole_mag*(-2*cos(omega_notch)); a2 = (pole_mag)^2; b0 = 1; b1 = -2*cos(omega_notch); b2 = 1; % % FILTER DATA % y(1) = b0*x(1); % Start filter at beginning of signal y(2) = -a1*y(1) + b0*x(2) + b1*x(1); for n=3:xlen y(n) = -a1*y(n-1)-a2*y(n-2)+b0*x(n)+b1*x(n-1)+b2*x(n-2);% Recursive difference equation (Direct Form I) implementation end % DONE!...
View Full Document

## This note was uploaded on 01/22/2011 for the course ECE 410 taught by Professor Staff during the Spring '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online