Functions > Data Analysis > Curve Fitting > Example: Nonlinear Regression 1
Example: Nonlinear Regression 1
Use the genfit function to find fitting parameters for a general nonlinear fit.
1. Define a data set.
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Construct the function to be fed to the genfit function. Enter the fitting function, and then add the derivatives with respect to each parameter. For the derivatives, use the exp function instead of e.
Click to copy this expression
The parameters must be specified as elements in a vector of parameters, using the index operator.
3. Provide guess values.
Click to copy this expression
4. Call the genfit function.
Click to copy this expression
Click to copy this expression
5. Plot the data set and the general nonlinear fit.
Click to copy this expression
Click to copy this expression
6. Use function corr to check the correlation between vy and GNfit.
Click to copy this expression
The fit is perfect, as is confirmed by the above result.
Reference
The data for this example is drawn from Lanczos, C., Applied Analysis, Prentice Hall, 1956, pages 272-280, as documented in the NIST Statistical Reference Dataset Archive.
Was this helpful?