Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8970 > unrolled thread
| Started by | Juan Baselga <juan.baselga@gmail.com> |
|---|---|
| First post | 2012-03-12 09:08 +0000 |
| Last post | 2012-03-13 08:10 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Non linear model fitting with an integral model Juan Baselga <juan.baselga@gmail.com> - 2012-03-12 09:08 +0000
Re: Non linear model fitting with an integral model DC <b.gatessucks@gmail.com> - 2012-03-13 08:10 +0000
| From | Juan Baselga <juan.baselga@gmail.com> |
|---|---|
| Date | 2012-03-12 09:08 +0000 |
| Subject | Non linear model fitting with an integral model |
| Message-ID | <jjkeeg$1a6$1@smc.vnet.net> |
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?
[toc] | [next] | [standalone]
| From | DC <b.gatessucks@gmail.com> |
|---|---|
| Date | 2012-03-13 08:10 +0000 |
| Message-ID | <jjmvef$cl8$1@smc.vnet.net> |
| In reply to | #8970 |
Use ?NumericQ in the definition of your model :
In[2]:= data=Table[{i,i^2+RandomReal[{-0.5,-.5}]},{i,1,5}]
Out[2]= {{1,0.5},{2,3.5},{3,8.5},{4,15.5},{5,24.5}}
In[3]:= model[a_?NumericQ, b_?NumericQ,x_?NumericQ]:=Integrate[a t+b,{t,0,x}]
In[4]:= NonlinearModelFit[data,model[a,b,x],{a,b},x]
Out[4]= FittedModel[model[2.1087,-0.358696,x]]
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web