
function y=bandPass(x,Fs,lowfreq,highfreq,n)
%BANDPASS filter using a Finite Impulse Response filter and hanning window.
%bandPass(x,Fs,lowfreq,highfreq,n)
%x is signal to filter, Fs is the sampling rate, lowfreq and highfreq the 
%lower and upper bandpass cutoff frequencies. n is the filter order.
%If n is not specified, a filter order of 100 will be used.

if(nargin<5),
    n=100;
end
B=fir1(n,[2.*lowfreq./Fs 2.*highfreq./Fs],hanning(n+1));
y=fftfilt(B,x);

% [EOF] bandPass
