function [ ] = runFiltersTranslationStage( data )

% Use the following:
% 1. Moving average (delayed)
% 2. Moving average (no delay)
% 3. Savitzky-Golay
% 4. Resampling
% 5. Median Filter
% 6. Hampel Filter

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


N = 90;
coeffMA = ones(1, N)/N;
time = 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 avg24hTempC]);

    plot(time, data, time-fDelay/N, avgData, 'r');
    axis tight;
    legend('X axis acceleration','Moving average (no-delayed)','location','best');
    ylabel('Acceleration (m/s^2)');
    xlabel('Time (sec)');
    title('Linear Table Test - acceleration = 1 mm/s/s');
    
% Plot 02 - Moving Average - no delay
figure(2)
clf
    cubicMA   = sgolayfilt(data, 3, 91);
    quarticMA = sgolayfilt(data, 5, 91);
    quinticMA = sgolayfilt(data, 9, 91);
    plot(time-fDelay/N, avgData, time, [cubicMA quarticMA quinticMA]);
    
    legend('Acceleration X-axis MA','Cubic-Weighted MA', 'Quartic-Weighted MA','Quintic-Weighted MA','location','southeast');
    xlabel('Time elapsed from Jan 1, 2011 (days)');
    ylabel('Time (sec)');
    title('Savitzky-Golay Filter');
    axis([3 length(data) -0.1 .1]);

% % Plot 03 - Savitzky - Golay
% figure(3)
% clf
% 
% % Plot 04 - Moving Average
% figure(4)
% clf
% 
% % Plot 05 - Moving Average
% figure(5)
% clf

% Plot 06 - Moving Average
% figure(6)
% clf


    
    

