Until now I have been using the Nonlinearmodelfit without any issues, but I want to add a new constrain (Integral or NIntegral) to my modelfit.
My fitting function is (xt1 - xs1)*(2*Pi*freq*tao1)^(1 - alpha1)*
Cos[alpha1*Pi/2]/(1 + 2*(2*Pi*freq*tao1)^(1 - alpha1)*Sin[alpha1*Pi/2] +
(2*Pi*freq*tao1)^(2 - 2*alpha1))
where freq is my known variable and the others (xs1, xt1, alpha1 and tao1) the fitting parameters.
Until now it was all ok, but I wanted to add as constrain NIntegral[previousfunction,{freq,1,100000}] > something. I get printed the following error "has evaluated to non-numerical values for all sampling points in the region with boundaries {{1,100000}".
I checked the integral is, in fact, performed very fast when the fit parameters are known but: Why does not the NonLinearModelFit use the parameters of the fit in order to perform the integral?
NonlinearModelFit[dato, {ximg, {0 < xs1 < 1, xs1 < xt1 < 3, 0 < alpha1 < 1, NIntegral[ximg, {freq, 1, 100000}] > propProces}}, {{xs1, inixs1}, {xt1, inixt1}, {alpha1, inialpha1}, {tao1, initao1}}, {freq}, MaxIterations -> 10000];
Thank you, probably I am missing an important code
PS: In case of wonder, I am interested on this because my actual fit is in fact:
NonlinearModelFit[dato, {(ximg1+ximg2), {0 < xs1 < 1, xs1 < xt1 < 3, 0 < alpha1 < 1, NIntegral[ximg1/(ximg1+ximg2), {freq, 1, 100000}] > propProces, 0 < xs2 < 1, xs2 < xt2 < 3, 0 < alpha2 < 1}}, {{xs1, inixs1}, {xt1, inixt1}, {alpha1, inialpha1}, {tao1, initao1}, {xs2, inixs2}, {xt2, inixt2}, {alpha2, inialpha2}, {tao2, initao2}}, {freq}, MaxIterations -> 10000];
I want the integral to calculate the weigth between the two.