I am having trouble using FindFit with the following function.
f[x_] := NIntegrate[a x k, {k, 0, 1}];
data = {{0, 0}, {0.2, 0.1}, {0.4, 0.2}};
param = FindFit[data, {f[x],2>a>1},a, x]
I get the following error
NIntegrate::inumr: The integrand a k x has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}. >>
Yet I can easily plot the function if I set "a" to any value between 1 and 2. So I assume FindFit is not assigning "a" a numerical value for some reason?
This function is the simplest function in which I can reproduce the error (The data set is similarly a toy dataset). The actual function I need to use will be more complicated, so unfortunately getting rid of NIntegrate is not possible.
Thanks
NumericQ
. $\endgroup$