Example 1. Fit the
curve
to
the data points
.
Solution 1.
Enter the point into a two dimensional array xys which stores points in the xy-plane.
Look at the transpose of this "list of lists."
The two portions of this data structure are separated
by breaking off the first and second parts of the "list of
lists"
and
.
We want to use the same abscissas, and take the logarithm of the
ordinates. Notice that Mathematica
uses Log[x] for the natural
logarithm ln(x) this is because
Mathematica has programmed the notation used in "Complex
Variables" i.e. the
terminology Log[x] is used in
advanced mathematics and works both with real and complex
numbers.
Caution. None of the
abscissas should be 0 because Log[0] is not defined, and all
the abscissas "should" be positive, unless you are willing to "cope"
with computations that might involve complex numbers.
Now "glue together" the transformed parts to form the
pairs
and
store them in the two dimensional array XYs which stores
points in the XY-plane.
Now use the Mathematica procedure Fit to get the least squares line in the XY-plane.
Now plot the "least squares line"
in
the XY-plane.
![[Graphics:../Images/NonLinearCurveFitMod_gr_45.gif]](../Images/NonLinearCurveFitMod_gr_45.gif)
To get back to the xy-plane we could copy the coefficients
from g or we could go looking inside
Mathematica to see where they are kept.
The data structure of g looks like:
So the coefficients A is located at
and B is located at
.
Now we are in business, we use
and
to
get the coefficients of
back
in the original xy-plane.
Now graph the function
in
the xy-plane.
![[Graphics:../Images/NonLinearCurveFitMod_gr_67.gif]](../Images/NonLinearCurveFitMod_gr_67.gif)
(c) John H. Mathews 2004