%% Smooth Data with Moving Average
% Create a vector containing noisy data, and smooth the data with a moving average.  Plot the original and smoothed data.

x = 1:100;
A = cos(2*pi*0.05*x+2*pi*rand) + 0.5*randn(1,100);
B = smoothdata(A);
plot(x,A,'-o',x,B,'-x')
legend('Original Data','Smoothed Data')

% Copyright 2012 The MathWorks, Inc.