function [y,ny] = delay(x,nx,n0) N = length(nx); if n0 >= 0 ny = [ nx(1):nx(1)+N+n0-1 ]; elseif n0 < 0 ny = [ nx(1)+n0:nx(1)+N-1 ]; end; M = length(ny); y = zeros(size(ny)); if n0 > 0 y(n0+1:M) = x; else y(1:M+n0) = x; end