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


Groups > comp.soft-sys.math.mathematica > #11865 > unrolled thread

Re: NonlinearModelFit and assumptions on fit parameters

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-09-24 04:48 +0000
Last post2012-09-24 04:48 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: NonlinearModelFit and assumptions on fit parameters Bill Rowe <readnews@sbcglobal.net> - 2012-09-24 04:48 +0000

#11865 — Re: NonlinearModelFit and assumptions on fit parameters

FromBill Rowe <readnews@sbcglobal.net>
Date2012-09-24 04:48 +0000
SubjectRe: NonlinearModelFit and assumptions on fit parameters
Message-ID<k3oona$bcg$1@smc.vnet.net>
On 9/23/12 at 3:01 AM, niels.martinsen@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]

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web