Re: FindFit & NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg96136] Re: FindFit & NIntegrate
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 6 Feb 2009 04:12:56 -0500 (EST)
On 2/5/09 at 4:42 AM, hans.malissa at gmx.net (hmalissa) wrote: >I want to use the FindFit function (or similar) to fit some >experimental data: >fit=FindFit[data,expr,pars,vars] >Usually this works very well, but in this particular case the model >expr consists of a NIntegrate over another function, like: >model[x_,a_,b_,c_]:=NIntegrate[function[x_,t_,a_,b_,c_],{t,0,inf}]; >fit=FindFit[data,model[x,a,b,c],{a,b,c},x] >FindFit now complains about non-numerical values; of course that >makes sense. How can I force FindFit to do the fitting anyway? I assume the model you are fitting is inherently non-linear, i.e., that the model cannot be written as Sum[a[k] NIntegrate[...], {k...}] where a[k] are the unknown parameters and everything being fed to NIntegrate has a known value. If you can linearize the problem in the form I've indicated there should be no difficulty. If this cannot be done you have a very difficult problem. The basic approach would be to approximate the integral with something that exposes the parameters to FindFit. Possibly, the integral can be approximated as a polynomial using say a series expansion. Alternatively, you can replace NIntegrate with code that uses say Simpson's rule to create an symbolic expression containing the unknown parameters. The only other approach I can see to solve this type of problem is to find another way to model the data that did not involve solving an integral.