lagpoly.m (557B)
1 function y=lagpoly(x,rho,y0); 2 3 % lagpoly.m 2/26/97 4 % 5 % Applies a lag polynomial to calculate y, where 6 % 7 % y(t) = 1/(1-rho*L) x(t) 8 % 9 % ==> y(t) = x(t) + rho*x(t-1) + rho^2*x(t-2) + ... 10 % 11 % Of course, in practice, we do not observe the infinite past, so we need a 12 % starting point, which is y0. Therefore, what this procedure actually 13 % does is the following: 14 % 15 % y(t) = (1+rho*L+...+rho^(t-1)L^(t-1))*x(t) + rho^t*y(0) 16 17 T=size(x,1); 18 y=zeros(T,1); 19 20 for t=1:T; 21 y(t)=(rho^t)*y0; 22 for k=0:(t-1); 23 y(t)=y(t)+(rho^k)*x(t-k); 24 end; 25 end;