Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: NonlinearModelFit and assumptions on fit parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128208] Re: NonlinearModelFit and assumptions on fit parameters
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 24 Sep 2012 00:33:29 -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

On 9/23/12 at 3:01 AM, niels.martinsen at gmail.com (Niles) wrote:

>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?

Look up NonlinearModelFit in the Documentation Center and you
will find the second argument can be given in the form {model,
constrainte}. So, all you need do is

nlm = NonlinearModelFit[
   data, {fitFuncExactNoLosses[a, b, x], b > 0}, {{a, 1}, {b,
1}}, x]




  • Prev by Date: Re: Remove cell content
  • Next by Date: Re: regression MIMO problem, fix the parameters
  • Previous by thread: Re: NonlinearModelFit and assumptions on fit parameters
  • Next by thread: Re: NonlinearModelFit and assumptions on fit parameters