Re: NonlinearModelFit and assumptions on fit parameters

• To: mathgroup at smc.vnet.net
• Subject: [mg128206] Re: NonlinearModelFit and assumptions on fit parameters
• From: Frank K <fkampas at gmail.com>
• Date: Mon, 24 Sep 2012 00:32:49 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <k3mc32\$72m\$1@smc.vnet.net>

```On Sunday, September 23, 2012 3:02:11 AM UTC-4, Niles wrote:
> Hi
>
>
>
> I have a set of data (x, y) that I can succesfully fit a nonlinear function to using NonlinearModelFit:
>
>
>
>
>
> data = {{1, 1}, {2, 2}, {3, 3.2}};
>
> fitFuncExactNoLosses[a_, b_, x_] := a*x^2 + b + x;
>
> nlm = NonlinearModelFit[data, fitFuncExactNoLosses[a, b, x],
>
>   {
>
>    {a, 1},
>
>    {b, 1}},
>
>   x]
>
>
>
>
>
> However, the paramter "b" comes out negative and it *must* be positive. Is there a way to utilize assumptions such that b is constrained to be grater than zero?
>
>
>
> Best,
>
> Niels.

You could change b to b^2 in the fitting function and take the square root afterwards.

```

• Prev by Date: Re: NonlinearModelFit and assumptions on fit parameters
• Next by Date: Re: Remove cell content
• Previous by thread: Re: NonlinearModelFit and assumptions on fit parameters
• Next by thread: Re: NonlinearModelFit and assumptions on fit parameters