The non-linear regression problem (univariate or multivariate) is easily posed using a graphical user interface (GUI) that solves the problem using one of the following solvers:
- nlinfit: only univariate problems.
- lsqnonlin: can deal with multivariate problems (more than one dependent fitting variable, ydata is a matrix).
- patternsearch: this solver is useful to obtain a good start point, before using nlinfit or lsqonolin; this way, the global minimum is determined easier.
Data is introduced in the GUI as vector or matrix from the workspace.
The model to be fitted must be written in an M-file in vectorized form:
ypred = model(x,xdata)
ypred is a column vector (univariate problem) or matrix (multivariate problem) with the model response (observations in rows).
x is a vector with the parameters of the model to be fitted.
xdata is a matrix with the independent variables in columns and observations in rows.
An example of a kinetic equation fitting using data from a batch chemical reactor is enclosed.
Requirements: Optimzation toolbox/ Statistic toolbox/ Genetic algorithm and direct search toolbox depending on the selected solver.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.