Re: FindFit & NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg96141] Re: FindFit & NIntegrate
- From: dh <dh at metrohm.com>
- Date: Fri, 6 Feb 2009 04:13:50 -0500 (EST)
- References: <gmecbc$acc$1@smc.vnet.net>
Hi, this problem comes up all the time. The cause is, that FindFit first calls the model with symbolic arguments and parameters, in order to see if it can simplify it. To prevent this, you have to declare the model argument as numerical, like e.g.: fun[x_?NumericQ] hope this helps, Daniel 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? >