reverse-shooting

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

polysmooth.m (316B)


      1 function ys=polysmooth(y,p);
      2 
      3 % polysmooth.m
      4 %
      5 %  Polynomial smoother -- Run a regression of y on a pth order polynomial
      6 %  and return the fitted values.
      7 
      8 
      9 T=length(y);
     10 t=(1:T)';
     11 X=[];
     12 for n=0:p;
     13   X=[X t.^n];
     14 end;
     15 beta=lstiny(y,X);
     16 ys=X*beta;
     17 
     18 % figure(1); clf;
     19 % plot(t,y); hold on;
     20 % plot(t,ys,'go');
     21 
     22 % keyboard