expfit

Exponential least-squares curve fit function.

Syntax

expfit(indep_vec, dep_vec [1])

Argument

indep_vec
The independent vector of the curve to fit.
dep_vec
The dependent vector of the curve to fit.
[1]
If this optional parameter is included, the polynomial coefficients are returned instead of the vectors.

Example

Curve Math Vectors Result
x = c1.x

y = expfit(c1.x, c1.y)

Given c1, an exponential function fitting the curve is created.

Comments

The expfit function returns an exponential least squares fit solution. indep_vec and dep_vec must have the same number of elements.

The result is the exponential function, y = aebx, which best fits the original curve as determined by least squares criteria. expfit also returns the exponential coefficients and the mean deviation.

All values in dep_vec must be strictly positive (in other words, greater than and NOT equal to zero).