Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11864

Re: NonlinearModelFit and assumptions on fit parameters

From Frank K <fkampas@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: NonlinearModelFit and assumptions on fit parameters
Date 2012-09-24 04:48 +0000
Message-ID <k3oon0$bce$1@smc.vnet.net> (permalink)
References <k3mc32$72m$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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.  

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

NonlinearModelFit and assumptions on fit parameters Niles <niels.martinsen@gmail.com> - 2012-09-23 07:00 +0000
  Re: NonlinearModelFit and assumptions on fit parameters DC <b.gatessucks@gmail.com> - 2012-09-24 04:47 +0000
  Re: NonlinearModelFit and assumptions on fit parameters Frank K <fkampas@gmail.com> - 2012-09-24 04:48 +0000

csiph-web