function y = echfiltre(x,Fe,t,gain)
%        y = echfiltre(x,Fe,t,gain)
% echos successiFe de x, via feedback
% retard t + filtrage passe-bas
%------------------------------------

% y_k - gain*y_{k-N} = x_{k-N}
% H(z) = z^(-N) / [1 - gain*z^(-N)]

h = 1/Fe; 
N = ceil(t/h);
lx = length(x);
y = zeros(1,lx+N);

for  k = N+1:N+lx
    y(k) = gain*y(k-N) + x(k-N);
end

b = fir1(10,.1);
y = filter(b,1,y);
