Presentation is loading. Please wait.

Presentation is loading. Please wait.

MODEL FITTING jiangyushan. Introduction The goal of model fitting is to choose values for the parameters in a function to best describe a set of data.

Similar presentations


Presentation on theme: "MODEL FITTING jiangyushan. Introduction The goal of model fitting is to choose values for the parameters in a function to best describe a set of data."— Presentation transcript:

1 MODEL FITTING jiangyushan

2 Introduction The goal of model fitting is to choose values for the parameters in a function to best describe a set of data. There are many possible reason to do this. If a specific meaningful form for the function with a small number of free parameters is known in advance, this is called parametric fitting, and finding the parameter values themselves may be the goad (for example, measuring an exponential decay constant to determine a reaction rate).

3 Visual Model Fitting with the Original Data Suppose we want to fit the model to the data shown in Fig2.1. How might we choose the constants and to determine the line that best fits the data? Generally, when more than two data points exist, all of them cannot be expected to lie exactly along a single straight line, even if such a line accurately models the relationship between the two variables. Fig2.1

4 Interpolation The most straightforward way to fit a curve to the data D is to find a function f that passes through each of the n data points or samples. That is, find a function f such that Once a function is determined that satisfies (2.1),the value of y at other points can be estimated. In this case, the process of estimating y is referred to as interpolation.

5 Main Method for Interpolation and Curfitting Piecewise-Linear Interpolation Polynomial Interpolation Lagrange Interpolating Polynomials Newtons’s Difference Formula Cubic Splines Chebyshev Approximation Criterion Least squares curvefiting

6 Matlab Functions poly,interp1,spline, pchip, polyfit, polyval Lsqnonlin, lsqcurvefit, regress, nlinfit

7 Piecewise-Linear Interpolation interp1 1-D data interpolation (table lookup) Syntax yi = interp1(x,Y,xi) yi = interp1(Y,xi) yi = interp1(x,Y,xi,method) yi = interp1(x,Y,xi,method,'extrap') yi = interp1(x,Y,xi,method,extrapval) pp = interp1(x,Y,method,'pp') Description yi = interp1(x,Y,xi) interpolates to find yi, the values of the underlying function Y at the points in the vector or array xi. x must be a vector. Y can be a scalar, a vector, or an array of any dimension.

8 Visual Model Fitting with the Original Data Ordinarily, there will be some vertical discrepancy between a few of the data points and any particular line under consideration. We refer to these vertical discrepancies as absolute deviations (Fig 2.2). For the best-fitting line, we might try to minimize the sum of these absolute deviations, leading to the model depicted in Fig2.2. Although success may be achieved in minimizing the sum of the absolute deviations, the absolute deviation from individual points may be quite large. For example, consider point D in Fig2.2. If the modeler has confidence in the accuracy of this data point, there would be concern for the predictions made from the fitted line near the point. As an alternative, suppose a line is selected that minimizes the largest deviation from any point. Applying this criterion to the data points might give the line shown in Fig2.3.

9 Visual Model Fitting with the Original Data Fig2.2 minimizing the sum of these absolute deviations from the fitted line Absolute deviation Fig2.3 minimizing the largest absolute deviations from the fitted line

10 lsqcurvefit x = lsqcurvefit(fun,x0,xdata,ydata) Solve nonlinear curve-fitting (data-fitting) problems in least-squares sense Equation:Find coefficients x that best fit the equation given input data xdata, and the observed output ydata, where xdata and ydata are matrices or vectors of length n, and F (xdata) is a matrix- valued or vector-valued function.

11 Objectives Understand the difference between interpolation and curvefitting Know how to express piecewise-linear interpolation parametrically Know why interpolation with high-degree polynomials is undesirable Known why finding the interpolating polynomial by solving a linear algebraic system can be inaccurate.

12 Objectives Know how to construct and use Largrange interpolating polynomials to perform interpolation Be able to fit curves to the underlying trend of data using least-squares techniques. Understand how curve fitting techniques can be used to solve practical engineering problems. Understand the relative strengths and weaknesses of each computational method and know which are most applicable for a given problem.

13 The following data represent the growth of a population o f fruit flies over a 6-week period. Test the following model s by plotting an appropriate set of data. Estimate the par ameters of the models: The growth of a population of fruit flies T (days) 71421283542 P (number of observed flies) 841133250280297


Download ppt "MODEL FITTING jiangyushan. Introduction The goal of model fitting is to choose values for the parameters in a function to best describe a set of data."

Similar presentations


Ads by Google