Re: How to assign the result from NonlinearFit to a function

• To: mathgroup at smc.vnet.net
• Subject: [mg70232] Re: How to assign the result from NonlinearFit to a function
• From: Peter Pein <petsie at dordos.net>
• Date: Sun, 8 Oct 2006 02:04:52 -0400 (EDT)
• References: <eg847g\$ng0\$1@smc.vnet.net>

```PengYu.UT at gmail.com schrieb:
> I have the following code. I want to assign the resulting function of
> NonlinearFit to function f. But it seems that it doesn't work. Would
>
> Thanks,
> Peng
>
> << Statistics`NonlinearFit`
>
> data = {{1.0, 1.0, .126}, {2.0, 1.0, .219}, {1.0, 2.0, .076}, {2.0,
> 2.0, .126}, {.1, .0, .186}};
>
> f[theta1_, theta2_,  theta3_] := NonlinearFit[data, theta1 theta3 x1/(1
> + theta1 x1 + theta2 \
> x2), {x1, x2}, {theta1, theta2, theta3}]
>

Hi,

NonlinearFit calculates constant values for the thetas. You surely want

f[x1_, x2_] := Evaluate[NonlinearFit[data,
theta1*theta3*(x1/(1 + theta1*x1 + theta2*x2)),
{x1, x2}, {theta1, theta2, theta3}]]

Peter

```

• Prev by Date: Re: Troubles with Integrate
• Next by Date: Re: FoourierTransform of a function defined in sections
• Previous by thread: How to assign the result from NonlinearFit to a function
• Next by thread: Re: How to assign the result from NonlinearFit to a function