MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NonlinearModelFit and assumptions on fit parameters


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