8
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: where a and b are the amplitudes, and c are the periods (cycles) of the data. The question to answer here is how many cycles exist? As a first attempt, assume a single cycle and fit the data using one cosine term and one sine term. 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 coefficient c is included as part of the trigonometric function arguments. Load Data and Fit Library and Custom Fourier Models Load the data and open the Curve Fitting app: load enso cftool 1. The toolbox 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 frequency w. Refer to Fourier Series for more information. Create the built-in library Fourier fit to compare with your custom equations: Select month for X data and pressure for Y data. a. Select Fourier for the model type. b. Enter Fourier for the Fit name. c. Change the number of terms to 8. Observe the library model fit. In the next steps you will create custom equations to compare. d. 2. y(x) = a 0 + i=1 a i cos ( 2π x c i ) + b i sin ( 2π x c i ) i i i y 1 (x) = a 0 + a 1 cos ( 2π x c 1 ) + b 1 sin ( 2π x c 1 ) 1 Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana... 1 de 8 02/09/2015 03:56 p. m.

enso

Embed Size (px)

DESCRIPTION

analisis por minimos cuadrados no lineales

Citation preview

Page 1: enso

Custom Nonlinear ENSO Data AnalysisThis example fits the ENSO data using several custom nonlinear equations. The ENSO data consists of monthly averagedatmospheric pressure differences between Easter Island and Darwin, Australia. This difference drives the trade winds in thesouthern hemisphere.The ENSO data is clearly periodic, which suggests it can be described by a Fourier series:

where a and b are the amplitudes, and c are the periods (cycles) of the data. The question to answer here is how many cyclesexist?As a first attempt, assume a single cycle and fit the data using one cosine term and one sine term.

If the fit does not describe the data well, add additional cosine and sine terms with unique period coefficients until a good fit isobtained.The equation is nonlinear because an unknown coefficient c is included as part of the trigonometric function arguments.Load Data and Fit Library and Custom Fourier Models

Load the data and open the Curve Fitting app:load ensocftool

1.

The toolbox includes the Fourier series as a nonlinear library equation. However, the library equation does not meet theneeds of this example because its terms are defined as fixed multiples of the fundamental frequency w. Refer to FourierSeries for more information. Create the built-in library Fourier fit to compare with your custom equations:

Select month for X data and pressure for Y data.a. Select Fourier for the model type.b. Enter Fourier for the Fit name.c. Change the number of terms to 8.Observe the library model fit. In the next steps you will create custom equations to compare.

d.

2.

y(x) = a0 +∞i=1

ai cos(

2π xci

)

+ bi sin(

2π xci

)

i i i

y1(x) = a0 + a1 cos(

2π xc1

)

+ b1 sin(

2π xc1

)

1

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

1 de 8 02/09/2015 03:56 p. m.

Page 2: enso

Duplicate your fit. Right-click your fit in the Table of Fits and select Duplicate ‘Fourier'.3. Name the new fit Enso1Period.4. Change the fit type from Fourier to Custom Equation.5. Replace the example text in the equation edit box with

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

The toolbox applies the fit to the enso data.

6.

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

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

2 de 8 02/09/2015 03:56 p. m.

Page 3: enso

By default, the coefficients are unbounded and have random starting values from 0 to 1. The data include a periodic componentwith a period of about 12 months. However, with c1 unconstrained and with a random starting point, this fit failed to find that cycle.Use Fit Options to Constrain a Coefficient

To assist the fitting procedure, constrain c1 to a value from 10 to 14. Click the Fit Options button to view and edit constraintsfor unknown coefficients.

1.

In the Fit Options dialog box, observe that by default the coefficients are unbounded (bounds of -Inf and Inf).2. Change the Lower and Upper bounds for c1 to constrain the cycle from 10 to 14 months, as shown next.3.

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

3 de 8 02/09/2015 03:56 p. m.

Page 4: enso

Click Close. The Curve Fitting app refits.4. Observe the new fit and the residuals plot. If necessary, select View > Residuals Plot or use the toolbar button.5.

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

4 de 8 02/09/2015 03:56 p. m.

Page 5: enso

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 the Results pane (c1=11.94) indicate a cycle of approximately 12 months. However, the residualsshow a systematic periodic distribution, indicating that at least one more cycle exists. There are additional cycles that youshould include in the fit equation.

Create Second Custom Fit with Additional Terms and ConstraintsTo refine your fit, you need to add an additional sine and cosine term to y (x) as follows:

and constrain the upper and lower bounds of c to be roughly twice the bounds used for c .Duplicate your fit by right-clicking it in the Table of Fits and selecting Duplicate ‘Enso1Period'.1. Name the new fit Enso2Period.2. Add these terms to the end of the previous equation:

+a2*cos(2*pi*x/c2)+b2*sin(2*pi*x/c2)3.

Click Fit Options. When you edit the custom equation, the tool remembers your fit options. Observe the Lower and Upperbounds for c1 still constrain the cycle from 10 to 14 months. Add more fit options:

Change the Lower and Upper for c2 to be roughly twice the bounds used for c1 (20<c2<30).a. Change the StartPoint for a0 to 5.b.

As you change each setting, the Curve Fitting app refits. The fit and residuals are shown next.

4.

1

y2(x) = y1(x) + a2 cos(

2π xc2

)

+ b2 sin(

2π xc2

)

2 1

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

5 de 8 02/09/2015 03:56 p. m.

Page 6: enso

The fit appears reasonable for most data points. However, the residuals indicate that you should include another cycle to the fitequation.Create a Third Custom Fit with Additional Terms and ConstraintsAs a third attempt, add an additional sine and cosine term to y (x)

and constrain the lower bound of c to be roughly triple the value of c .Duplicate your fit by right-clicking it in the Table of Fits and selecting Duplicate ‘Enso2Period'.1. Name the new fit Enso3Period.2. Add these terms to the end of the previous equation:

+a3*cos(2*pi*x/c3)+b3*sin(2*pi*x/c3)3.

Click Fit Options Observe your previous fit options are still present.4. Change the Lower bound for c3 to be 36, which is roughly triple the value of c1.a. 5.

2

y3(x) = y2(x) + a3 cos(

2π xc3

)

+ b3 sin(

2π xc3

)

3 1

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

6 de 8 02/09/2015 03:56 p. m.

Page 7: enso

Close the dialog box. The Curve Fitting app refits. The fit and residuals appear next.b.

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

7 de 8 02/09/2015 03:56 p. m.

Page 8: enso

The fit is an improvement over the previous two fits, and appears to account for most of the cycles in the ENSO data set. Theresiduals appear random for most of the data, although a pattern is still visible indicating that additional cycles might be present, oryou can improve the fitted amplitudes.In conclusion, Fourier analysis of the data reveals three significant cycles. The annual cycle is the strongest, but cycles withperiods of approximately 44 and 22 months are also present. These cycles correspond to El Nino and the Southern Oscillation(ENSO).

Custom Nonlinear ENSO Data Analysis - MATLAB & Simulink http://www.mathworks.com/help/curvefit/custom-nonlinear-enso-data-ana...

8 de 8 02/09/2015 03:56 p. m.