%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Project : Test Averaging Filter
% Version : 1.00a
% Date : 2011.05.07
% Explanation : Test Program of AF
% Author : Yoon JaWoong
% CopyRight : MILab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all; clc;
tic
fs = 1000;
t = 0:1/fs:300;
Nsamples = length(t);
Avgsaved = zeros(Nsamples, 1);
input = zeros(Nsamples, 1);
for k=1:Nsamples
w = 0 + 0.1*randn(1,1);
xm = 5 + w;
input(k) = xm;
Avgsaved(k) = sum(input)/k;
end
figure
% plot(t, input, 'r:*')
% hold on
plot(t, Avgsaved, 'o-')
toc