%
% chapter 10 moving average filter example
%
load flow.dat;
i = find( flow(:,1) < 50 );
t = flow(i,1);
y = flow(i,2);
clear flow;
k = find( t > 12.7 & t < 15.7 );
%
figure;
plot( t(k)-12.7, y(k), '*' );
hold on;
%
for n = [ 3 5 10 ],
  yhat = Moving_Average_Filter( y, n );
  plot( t(k)-12.7, yhat(k) );
end;
hold off;
%
sxlabel( '\20Time {\times \24 \it t}' );
sylabel( '\20Data {\times \24 \it y} and moving averages {\times \24 \hat {\it y}}' );
stext( 0.55, 5.45, '\20data' );
stext( 0.60, 5.10, '\20{\times \24 \it n} = 3' );
stext( 0.75, 4.85, '\20{\times \24 \it n} = 5' );
stext( 1.50, 4.35, '\20{\times \24 \it n} = 10' );
%
printsto -f1 -deps2 mafilter.eps
%

