Here is the code for the Matlab implementation of our system.
%function to obtain a bandpass filter of w1 to w2
% returns a vector of all bands that need to be filtered out
% because they excede the threshold
%inially run with start=1
function omegas = bands(sig, Fs, thresh, start)
%check each frequency, return first value and last value
samples=length(sig);
F_w=(abs(fft(sig)));
w1=[];
%w2=[];
for i=start:samples
if isempty(w1) & F_w(i)>thresh
w1=(i-1)
F_w(w1-1)
w2_start=w1+1
end
end
for j=w2_start:samples
if F_w(j)<thresh
w2=j
F_w(w2)
break
end
end
if start<samples & not(isempty([w1, w2]))
temp_omega = [w1, w2]
omegas = cat(2, temp_omega, bands3(sig, Fs, thresh, j+2));
end
This Code will have an output vector of all of the sample
frequencies that need to be filltered. The next portion of the
implemintation utilized Matlabs Digital Filter Tool. Imput desired
frequencies to be Band stopped. Here is a sample of what the Filter
toolbox will look like.
Once this filter has been designed with the toolbox for each frequncy desired
in the window, implement the filter using the filter comand.
Then simply add up all of the newly-filtered-window vectors.