function Ynorm=eventsnormalize(Y,DF,np) %EVENTSNORMALIZE multi periods array normalizing % YNORM = EVENTSNORMALIZE(Y,DF,NP) normalize the columns of % the matrix/array Y in NP points between the time % intervals defined by the matrix DF: % % DF= % F1beg,F1end % F2beg,F2end % ... % Fnbeg,Fnend % % Use carefully this function because no anti aliasing % filter is applied!!! % % See also eventscycle % Author(s): F. Patanč, 2000 c=size(Y,2); intervals=size(DF,1); if isempty(DF)|np<=1|isempty(Y) Ynorm=[]; return else Ynorm=zeros(np*intervals,c); for i=1:intervals l=DF(i,2)-DF(i,1)+1; if l>1.5*np Ynorm((i-1)*np+1:i*np,:)=resample(Y( DF(i,1):DF(i,2),: ),np,l,0); else Ynorm((i-1)*np+1:i*np,:)=upresample(Y( DF(i,1):DF(i,2),: ),np,l,2); end end end