function LF_filtered = bandpassfilter(signal,Fs,fband)
% Filtering LF freq
% number of observations
Nt = size(signal,1);

% frequency axis
df = Fs/Nt;
odd = (round(Nt/2)-(Nt/2) == 0.5);

if odd
   f = 0:(Nt-1)/2;
   f = [f,-(Nt-1)/2+f(1:(Nt-1)/2)];
else
   f = 0: Nt/2;
   f = [f,-Nt/2+f(2:(Nt/2))];
end
f = f(:)*df;

% fft data
Y = fft(signal);


% apply band-pass filter
Y((abs(f) < fband(1)) | (abs(f) > fband(2))) = 0;

% inverse fft 
LF_filtered = real(ifft(Y));

end