%------------------------------------- function y=cirshift(x,m,N) %y=output %x=input with length < N %m=sample shift %N=size of circular buffer %Method y[n]=x[n-m]mod N if length(x)>N error('N must be >= length(x)'); end x=[x zeros(1,N-length(x))]; %zero padding n=[0:1:N-1]; n=mod(n-m,N); y=x(n+1); %--------------------------------------