% runAveTest.m - Tests running average function.
%
% Created by: C. S. Tritt (v. 1.0)
% 
clear all; close all; clc;  % Start in clean state.
seed = mod(round(5e7*(now - 7e5)), 4e9); % Use now to generate seed.
rs = RandStream('mt19937ar', 'Seed', seed); % Create & seed generator.
m = input('Enter mean: '); % Get user input...
sd = input('Enter standard deviation: ');
n = input('Enter number of values to generate: ');
ind = zeros(n,1); % Preallocate vectors...
y_raw = zeros(n,1);
y_ave = zeros(n,1); 
for x = 1:n
    ind(x) = x; % Generate vector of independent values.
    y_raw(x) = m + sd*randn(rs, 1); % Generate y data with noise.
    y_ave(x) = runAve(y_raw(x)); % Smooth the y data.
end
plot(ind, y_raw, ind, y_ave);
title('Raw and Averaged Values');
xlabel('X (independent)');
ylabel('Y (dependent)');