function y = looparray(f, x, npts, stride)
% Compute f(x) for npts chunks of x, spaced by stride.
% Simon de Szoeke

i = 1;
count = 0;
N = length(x);
while count + npts <= N
    y(i) = f( x(count+(1:npts)) );
    count = count + stride;
    i = i + 1;
end