Next: Fitting a circle Up: If the Curve Fits, Previous: Fitting a cubic to

# Fitting other types of funtions

In the previous constructions, we dealt with functions that depended linearly upon the parameters to be fitted. We found them by solving a linear system of equations, a relatively easy task.

However, as explained at the beginning of this chapter, the same scheme works equally well for any function. In the general case, though, the resulting system that we must solve to find the best fit could depend non-linearly on the parameters, and the mere existence of solutions to such systems is not a trivial problem to settle. Take for instance, a function such as y = sin(mix). Assuming measurements (x1, y1),...,(xk, yk), we may take as our error the function

E(m1,..., mn) = (yj - sin(mixj))2 .

Its partial derivatives are quite easy to calculate, but it is far from clear if there are values of m1,..., mn where they all vanish simultaneously. For a particular set of values, we may ask Maple to solve the resulting system and get absolutely nothing. This either indicates an inability of Maple to handle such a system, or worse yet, the fact that such a system has no solution at all. Even when the latter happens, Maple itself might not be able to tell us so.

Sometimes, even if the function does not depend linearly on the coefficients, it can transformed to one which does. For example, if our data points {(xi, yi)} were believed to approximate an exponential function of the form y = aekx, then setting

E(a, k) = (yi - aekxi)2 .

would require us to solve the system

(yi - aekxi)ekxi = 0    (yi - aekxi)axiekxi = 0 .

While this isn't impossible, it is much more straightforward to make a change of variables.

Assuming the yi are all positive (which is reasonable since we believe the data is exponential), we can let zi = ln yi. Then we are trying to fit a function z = lnaekx, which reduces to the line z = ln a + kx. This is familiar territory, and we can just proceed as before.

Next: Fitting a circle Up: If the Curve Fits, Previous: Fitting a cubic to

Translated from LaTeX by Scott Sutherland
2002-08-29