function y= lravg(beta,k,x);

n = length(x);
A = zeros(n);
for i=-k:k;
  j = abs(i);
  A = A + diag(beta^j*ones(n-j,1),i);
end;
a = sum(A)';
y = (A*x)./a;
