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: [mg125419] Re: Non linear model fitting with an integral model
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 13 Mar 2012 03:05:08 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 3/12/12 at 4:07 AM, juan.baselga at gmail.com (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?

It is difficult to know exactly what the issue is that you are
having when you don't provide code showing what you are doing. I
will offer a guess.

The typical problem with using NIntegrate in the fashion you
describe is Mathematica attempts to perform the integration
before the fitting routing supplies numerical values for the key
variables. The solution is to define the function being
integrated so that it only evaluates with numerical input.

For example:

If I define f as

f[x_]:= x^2

This will evaluate for any x including symbolic values. As a
result (depending on details of your code) Mathematica can
attempt to evaluate this before x is given a numeric value. But
by defining f as:

f[x_?NumericQ]:=x^2

Mathematica will only evaluate f when x is given a numeric
value. My suggestion would be to add the pattern test ?NumericQ
to you function definitions and see if this fixes your problem.
If it doesn't you will need to supply more details of your
specific problem.




  • Prev by Date: Re: maximize crosscorrelation
  • Next by Date: Re: pole/zero plot for TransferFunctionModel in the control system package?
  • Previous by thread: Re: Non linear model fitting with an integral model
  • Next by thread: ChemicalData and other Scientific and Technical Data