function [wl_l Hs] = low_filter(T,wl,f1,f2)

%% input
fmax = 10;
%% Adjust data
% average water level
wlm = mean(wl);
% zero centered signal
wl = wl-wlm;
% detrend
wl = detrend(wl);
%% Fourier analyse
%sampling freq
fs = 1/(T(2) - T(1));
% nyquist freq
fn = fs/2;
% maximum freq
fn = min(fmax,fn);
n       = length(wl);
vy      = fft(wl,n);
df      = 1/(T(end)-T(1));

%vy = abs(vy);
fx = df*[0:1:round(length(T)/2) -1*floor(length(T)/2)+1:1:-1]';%'+0.5*df;

%% afjust frequentie to the fx spacing
fx(fx<f1 | fx>f2) = 0;
vy(fx<f1 | fx>f2) = 0;


vy(fx>fn) = 0;

%% Compute water level
wl_l = real(ifft(vy,n));
wl_l = wl_l; %+ wlm;
%% compute Hs low
E         = 0.5 * vy.^2* T(end)/n;
m0        = trapz(fx,E(:));
Hs        = 4.*sqrt(m0);

end
