Fit[]: how to obtain the parameter values?
- To: mathgroup at smc.vnet.net
- Subject: [mg31825] Fit[]: how to obtain the parameter values?
- From: Peter Marzlin <peter.marzlin at uni-konstanz.de>
- Date: Wed, 5 Dec 2001 06:51:50 -0500 (EST)
- Organization: University of Constance, Germany
- Sender: owner-wri-mathgroup at wolfram.com
Hi all,
I am trying to use Fit to get a linear least square fit with some
complicated functions. In principle this works fine, but I cannot
get the parameter values.
For instance, using the two functions
f1[x] = 2 and f2[x] = 3x
I would like to get the parameters a1 and a2 in the fit function
f[x] = a1 f1[x] + a2 f2[x]
for the set of data data = {{1, 2}, {2, 2.5}, {3, 3}}
Using the command
Fit[data, {f1[x], f2[x]}, x]
I get the answer 1.5 + 0.5 x
This is correct but not what I want. I need a1 and a2, but
they cannot easliy be obtained because Fit merges the prefactors
in the definition of f1 and f2 with the value of the parameters
a1 and a2.
Of course, in this simple example I can get a1 and a2 by hand, but
I am actually interested in a much more involved problem where
extracting
the parameter values from the Fit output is a rather tedious if not
practically impossible task.
Any help would be greatly appreciated.
Peter