Curve Fitting Toolbox | ![]() ![]() |
Example: Smoothing Data
This example smooths the ENSO data set using the moving average, lowess, loess, and Savitzky-Golay methods with the default span. As shown below, the data appears noisy. Smoothing might help you visualize patterns in the data, and provide insight toward a reasonable approach for parametric fitting.
The Smooth pane shown below displays all the new data sets generated by smoothing the original ENSO data set. Whenever you smooth a data set, a new data set of smoothed values is created. The smoothed data sets are automatically displayed in the Curve Fitting Tool. You can also display a single data set graphically and numerically by clicking the View button.
Use the Plotting GUI to display only the data sets of interest. As shown below, the periodic structure of the ENSO data set becomes apparent when it is smoothed using a moving average filter with the default span. Not surprisingly, the uncovered structure is periodic, which suggests that a reasonable parametric model should include trigonometric functions.
Refer to General Equation: Fourier Series Fit for an example that fits the ENSO data using a sum of sine and cosine functions.
Saving the Results
By clicking the Save to workspace button, you can save a smoothed data set as a structure to the MATLAB workspace. This example saves the moving average results contained in the enso
(ma)
data set.
The saved structure contains the original predictor data x
and the smoothed data y
.
![]() | Savitzky-Golay Filtering | Excluding and Sectioning Data | ![]() |