Curve Fitting Toolbox    

Example: Sectioning Periodic Data

For all parametric equations, the toolbox provides coefficient starting values. For certain types of data sets such as periodic data containing many periods, the starting values may not lead to satisfactory results. In this case, sectioning the data can provide you with improved starting values for the fit.

This example uses generated sine data with noise added. The time vector is given by t and the amplitude, frequency, and phase constant of the data are given by the vector cf.

Import the variables t and noisysine, and fit the data with a single-term sine equation. The Fitting GUI, Fit Options GUI, and Curve Fitting Tool are shown below. To display the fit starting values, click the Fit options button. Note that the amplitude starting point is reasonably close to the expected value, but the frequency and phase constant are not, which produces a poor fit.

To produce a reasonable fit, follow these steps:

  1. Create an exclusion rule that includes one or two periods, and excludes the remaining data.
  1. As shown below, an exclusion rule is created graphically by using the selection rubber band to exclude all data points outside the first period. The exclusion rule is named 1Period.

  1. Create a new fit using the single-term sine equation with the exclusion rule 1Period applied.
  1. The fit looks reasonable throughout the entire data set. However, because the global fit was based on a small fraction of data, goodness of fit statistics will not provide much insight into the fit quality.

  1. Fit the entire data set using the fitted coefficient values from the previous step as starting values.
  1. The Fitting GUI, Fit Options GUI, and Curve Fitting Tool are shown below. Both the numerical and graphical fit results indicate a reasonable fit.


  Example: Excluding and Sectioning Data Additional Preprocessing Steps