0001 function yhat=spence21(y)
0002
0003
0004
0005
0006 oten = ones(10,1);
0007 n = length(y);
0008 y = [ oten*y(1); y; oten*y(n) ];
0009
0010 n = length(y);
0011 k = 4:(n-3);
0012 y1 = -y(k-3) + y(k-1) + 2*y(k) + y(k+1) -y(k+3);
0013
0014 n = length(y1);
0015 k = 4:(n-3);
0016 y2 = y1(k-3)+y1(k-2)+y1(k-1)+y1(k)+y1(k+1)+y1(k+2)+y1(k+3);
0017
0018 n = length(y2);
0019 k = 3:(n-2);
0020 y3 = y2(k-2)+y2(k-1)+y2(k)+y2(k+1)+y2(k+2);
0021
0022 n = length(y3);
0023 k = 3:(n-2);
0024 y4 = y3(k-2)+y3(k-1)+y3(k)+y3(k+1)+y3(k+2);
0025
0026 yhat = y4/350;
0027 return;