function [ ] = movingAverage( data, sampleRate, numSeg )


%reference: http://www.mathworks.com/help/signal/examples/signal-smoothing.html

% Input the data, stored as a cell array named "data" - import the data using matlab import tool and save as a cellarray.
% We then need to convert the cell array to doubles.

% print to screen - need to put into variables
average = mean(data)
variance = var(data)

%numSeg = 100;
coeffMA = ones(1, numSeg)/numSeg;

% time in seconds
time = (1/sampleRate)*linspace(0,length(data), length(data));

% remove filter delay
fDelay = (length(coeffMA)-1)/2;

% Plot 01 - Moving Average (delayed
figure(1)
clf

    avgData = filter(coeffMA, 1, data);

    plot(time, data, time-fDelay/numSeg, avgData);
    axis tight;
    ylabel('Acceleration (m/s^2)');
    xlabel('Time (sec)');
    title('Linear Table Test - acceleration');
    axis([min(time), max(time), min(data)-2, max(data)+2]);
    % legend('X axis acceleration','Moving average (no-delayed)','location','best');
    
% Calculate the statistics

% print to screen - need to put into variables
averageFilter = mean(avgData(numSeg:end))
varianceFilter = var(avgData(numSeg:end))






    
    

