User`s guide

smooth
4-130
Remarks For the moving average and Savitzky-Golay methods, span must be odd. If an
even
span is specified, it is reduced by 1. If span is greater than the length of
ydata, it is reduced to the length of ydata.
Use robust smoothing when you want to assign lower weight to outliers. The
robust smoothing algorithm uses the 6MAD method, which assigns zero weight
to data outside six mean absolute deviations.
Another way to generate a vector of smoothed response values is to fit your
data using a smoothing spline. Refer to the
fit function for more information.
Example Suppose you want to smooth traffic count data with a moving average filter to
see the average traffic flow over a 5-hour window (
span is 5).
load count.dat
y = count(:,1);
yy = smooth(y);
Plot the original data and the smoothed data.
t = 1:length(y);
plot(t,y,'r-.',t,yy,'b-')
legend('Original Data','Smoothed Data Using ''moving''',2)
0 5 10 15 20 25
0
20
40
60
80
100
120
Original Data
Smoothed Data Using moving