%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % shift.m - program shifts x to give y such % that y(t)=x(t+delta*T). % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function y=shift(x,delta) n=length(x); j=round(delta*n); y=ones(1,n); tmp=ones(1,j); if j > 0 tmp(1:j)=x(1:j); y(1:n-j)=x(j+1:n); y(n-j+1:n)=tmp(1:j); elseif j < 0 j=abs(j); tmp(1:j)=x(n-j+1:n); y(j+1:n)=x(1:n-j); y(1:j)=tmp(1:j); else; y=x; end