0001 function z=nt_multishift2(x,nshifts)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 TBD
0018
0019
0020 if size(x,1)<max(shifts); error('shifts should be no larger than nrows'); end
0021 if min(shifts)<0; error('shifts should be nonnegative'); end
0022 shifts=shifts(:)';
0023 nshifts=numel(shifts);
0024
0025
0026 N=size(x,1)-max(shifts);
0027 shiftarray=nt_vecadd(nt_vecmult(ones(N,nshifts),shifts),(1:N)');
0028 [m,n,o]=size(x);
0029 z=zeros(N,n*nshifts,o);
0030
0031 if ~isempty(amplitudes)
0032 amplitudes=amplitudes(:)';
0033 if numel(amplitudes)~=numel(shifts); error('amplitudes and shifts should have same numel'); end
0034 for k=1:o
0035 for j=0:n-1
0036 y=x(:,j+1,k);
0037 z(:,j*nshifts+1: j*nshifts+nshifts,k)=nt_vecmult(y(shiftarray),amplitudes);
0038 end
0039 end
0040 else
0041 for k=1:o
0042 for j=0:n-1
0043 y=x(:,j+1,k);
0044 z(:,j*nshifts+1: j*nshifts+nshifts,k)=y(shiftarray);
0045 end
0046 end
0047 end
0048