allow negative lag (i.e. a lead)

time-shift
Marco Ratto 2020-10-29 17:13:00 +01:00
parent 1519e4673a
commit ebec3ede8a
1 changed files with 5 additions and 1 deletions

View File

@ -31,4 +31,8 @@ if nargin==1
end
x=x(:);
xlag=[NaN(n,1); x(1:end-n)];
if n>0
xlag=[NaN(n,1); x(1:end-n)];
else
xlag=[x(abs(n)+1:end); NaN(abs(n),1)];
end