Main Content

Custom Nonlinear ENSO Data Analysis

This example fits the ENSO data using several custom nonlinear equations. The ENSO data consists of monthly averaged atmospheric pressure differences between Easter Island and Darwin, Australia. This difference drives the trade winds in the southern hemisphere.

The ENSO data is clearly periodic, which suggests it can be described by a Fourier series:

y ( x ) = a 0 + i = 1 a i cos ( 2 π x c i ) + b i sin ( 2 π x c i )

whereaiandbiare the amplitudes, andciare the periods (cycles) of the data. Determine how many cycles exist.

As a first attempt, assume a single cycle and fit the data using one cosine term and one sine term.

y 1 ( x ) = a 0 + a 1 cos ( 2 π x c 1 ) + b 1 sin ( 2 π x c 1 )

If the fit does not describe the data well, add additional cosine and sine terms with unique period coefficients until a good fit is obtained.

The equation is nonlinear because an unknown coefficientc1is included as part of the trigonometric function arguments.

Load Data and Fit Library and Custom Fourier Models

  1. Load the data and open the Curve Fitter app.

    loadensocurveFitter

  2. The app includes the Fourier series as a nonlinear library equation. However, the library equation does not meet the needs of this example because its terms are defined as fixed multiples of the fundamental frequencyw. Refer toFourier Seriesfor more information. Create the built-in library Fourier fit to compare with your custom equations:

    1. In the app, on theCurve Fittertab, in theData部分中,点击Select Data. In the Select Fitting Data dialog box, selectmonthas theX Datavalue andpressureas theY Datavalue.

    2. On theCurve Fittertab, in theFit Type部分中,点击the arrow to open the gallery. In the fit gallery, clickFourierin theRegression Modelsgroup.

    3. In theTable Of Fitspane, double-click theFit namevalue and enterFourier.

    4. In theFit Optionspane, change the number of terms to8.

      Observe the library model fit. In the next steps, you will create custom equations to compare.

      Fourier fit plot for the ENSO data

  3. Duplicate your fit. Right-click your fit in theTable Of Fitspane and selectDuplicate "Fourier".

  4. Name the new fitEnso1Period.

  5. On theCurve Fittertab, in theFit Typesection, open the fit type gallery and clickCustom Equationin theCustomgroup.

  6. In theFit Optionspane, replace the example text in the equation edit box with the following:

    a0 + a1*cos(2*pi*x/c1) + b1*sin(2*pi*x/c1)

    Fit Options pane with custom equation

    The app applies the fit to theensodata.

The graphical and numerical results shown here indicate that the fit does not describe the data well. In particular, the fitted value forc1is unreasonably small. Your initial fit results might differ from these results because the starting points are randomly selected.

Custom equation fit plot for the ENSO data

Results pane for custom equation fit to ENSO data

By default, the coefficients are unbounded and have random starting values from 0 to 1. The data include a periodic component with a period of about 12 months. However, withc1unconstrained and with a random starting point, this fit failed to find that cycle.

Use Fit Options to Constrain a Coefficient

  1. To assist the fitting procedure, constrainc1to a value from 10 to 14. In theFit Optionspane, clickAdvanced Optionsto expand the section and view the constraints for the coefficients. Observe that by default the coefficients are unbounded (bounds of-InfandInf).

  2. In theCoefficient Constraintstable, change theLowerandUpperbounds forc1to constrain the cycle from 10 to 14 months, as shown next.

    Modified coefficient constraints for the Enso1Period fit

    The Curve Fitter app updates the fit.

  3. Observe the new fit and the residuals plot. If necessary, clickResiduals Plotin theVisualizationsection of theCurve Fittertab.

    Fit and residuals plots for the Enso1Period fit

    The fit appears to be reasonable for some data points but clearly does not describe the entire data set very well. As predicted, the numerical results in theResultspane (c1=11.94)表示一个周期约为12个月。如何ever, the residuals show a systematic periodic distribution, indicating that at least one more cycle exists. There are additional cycles that you should include in the fit equation.

Create Second Custom Fit with Additional Terms and Constraints

To refine your fit, you need to add an additional sine and cosine term toy1(x) as follows:

y 2 ( x ) = y 1 ( x ) + a 2 cos ( 2 π x c 2 ) + b 2 sin ( 2 π x c 2 )

and constrain the upper and lower bounds ofc2to be roughly twice the bounds used forc1.

  1. Duplicate your fit by right-clicking it in theTable Of Fitspane and selectingDuplicate "Enso1Period".

  2. Name the new fitEnso2Period.

  3. In theFit Optionspane, add two terms to the end of the previous equation so that the equation box displays the following terms:

    a0 + a1*cos(2*pi*x/c1) + b1*sin(2*pi*x/c1) + a2*cos(2*pi*x/c2) + b2*sin(2*pi*x/c2)

  4. ClickAdvanced Optionsto expand the section. In theCoefficient Constraintstable, observe theLowerandUpperbounds forc1, which constrain the cycle from 10 to 14 months. Add more coefficient constraints.

    1. Change theLowerandUpperbounds forc2to be roughly twice the bounds used forc1(20<c2<30).

    2. Change theStartPointvalue fora0to5.

    As you change each setting, the Curve Fitter app updates the fit. You can observe the fit plot and the residuals plot.

Fit and residuals plots for the Enso2Period fit

The fit appears reasonable for most data points. However, the residuals indicate that you should include another cycle to the fit equation.

Create a Third Custom Fit with Additional Terms and Constraints

As a third attempt, add an additional sine and cosine term toy2(x)

y 3 ( x ) = y 2 ( x ) + a 3 cos ( 2 π x c 3 ) + b 3 sin ( 2 π x c 3 )

and constrain the lower bound ofc3to be roughly triple the value ofc1.

  1. Duplicate your fit by right-clicking it in theTable Of Fitspane and selectingDuplicate "Enso2Period".

  2. Name the new fitEnso3Period.

  3. In theFit Optionspane, add two terms to the end of the previous equation so that the equation box displays the following terms:

    a0 + a1*cos(2*pi*x/c1) + b1*sin(2*pi*x/c1) + a2*cos(2*pi*x/c2) + b2*sin(2*pi*x/c2) + a3*cos(2*pi*x/c3) + b3*sin(2*pi*x/c3)

  4. ClickAdvanced Optionsto expand the section. Observe that your previous fit options are still present.

  5. In theCoefficient Constraintstable, change theLowerbound forc3to36, which is roughly triple the value ofc1.

    Modified coefficient constraints for the Enso3Period fit

    As you change each setting, the Curve Fitter app updates the fit. You can observe the fit plot and the residuals plot.

Fit and residuals plots for the Enso3Period fit

The fit is an improvement over the previous two fits, and appears to account for most of the cycles in the ENSO data set. The residuals appear random for most of the data, although a pattern is still visible indicating that additional cycles might be present, or you can improve the fitted amplitudes.

In conclusion, Fourier analysis of the data reveals three significant cycles. The annual cycle is the strongest, but cycles with periods of approximately 44 and 22 months are also present. These cycles correspond to El Nino and the Southern Oscillation (ENSO).