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
- References:
- Non linear model fitting with an integral model
- From: Juan Baselga <juan.baselga@gmail.com>
- Non linear model fitting with an integral model