reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

ma.m (350B)


      1 % ma.m     y=ma(x,n)
      2 %  
      3 %     Constructs moving averages of a time series x using the average value
      4 %     for -nB years and +nF years; includes current observation.
      5 
      6 function y=ma(x,nB,nF);
      7 [T K]=size(x);
      8 y=zeros(T,K)*NaN;
      9 for i=(1+nB):(length(x)-nF);
     10    y(i,:)=zeros(1,K);
     11    for j=-nB:nF;
     12       y(i,:)=y(i,:)+x(i+j,:);
     13    end;
     14 end;
     15 y=y/(nB+nF+1);