Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Non linear model fitting with an integral model

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125427] Re: Non linear model fitting with an integral model
  • From: Darren Glosemeyer <darreng at wolfram.com>
  • Date: Tue, 13 Mar 2012 03:07:55 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203120907.EAA01317@smc.vnet.net>

On 3/12/2012 4:07 AM, Juan Baselga wrote:
> Hello, I'm new user of Mathemetica. I'm trying to fit data to a model, that is defined by an integral, using NonlinearModelFit. The integral contains the parameter I'm looking for. When I set a particular value for the parameter, NIntegrate works well giving an estimate of the integral value; but when I define the model within the fitting algorithm, the integral cannot be numerically evaluated since it contains the non-numerical parameter giving the "inumr" error message. Do anyone know how to fit data with model parameters contained in an integral that must be numerically evaluated?
>

The place to start is using a definition for the model that will only 
evaluate when all quantities that need to be numeric are numeric. 
Compare the results when using f1 and f2 in the following:

data = Table[{i, i^2/2}, {i, 5}];

f1[a_, y_] := NIntegrate[a*x, {x, 0, y}]

f1[a, y]

NonlinearModelFit[data, f1[a, y], a, y];

f2[a_?NumericQ, y_?NumericQ] := NIntegrate[a*x, {x, 0, y}]

f2[a, y]

NonlinearModelFit[data, f2[a, y], a, y]


?NumericQ restrictions like those in f2 are most likely what you need in 
your example.

Darren Glosemeyer
Wolfram Research



  • Prev by Date: Re: Trouble Getting Graphic Primitives in a Module to Display with Show Command
  • Next by Date: Re: Dynamically create Select criteria
  • Previous by thread: Non linear model fitting with an integral model
  • Next by thread: Re: Non linear model fitting with an integral model