I am trying to fit a function and Here is the code which I am trying, Please find the data here dataset
Data = Import["E:\\datat.asc"];
real = Data[[All, {1, 2}]];
imag = Data[[All, {1, 3}]];
w = 1.26*10^8;
k = 1.38*10^-23;
dynamicReal[T_?NumericQ, s_?NumericQ, d_?NumericQ, A_?NumericQ,t_?NumericQ] := A*(1 - (NIntegrate[(((1/(Sqrt[2*Pi]*s*H))*Exp[(-(Log[(H/d)])^2/(2*s^2))]))/((1 + (w^2*t^2*Exp[((2*H)/(k*T))]))), {H, 0, 6*10^-22}]))
dynamicImag[T_?NumericQ, s_?NumericQ, d_?NumericQ, A_?NumericQ,t_?NumericQ] := A (NIntegrate[(w*t*Exp[H/(k*T)] (((1/(Sqrt[2*Pi]*s*H))*Exp[(-(Log[(H/d)])^2/(2*s^2))])))/((1 + (w^2*t^2*Exp[((2*H)/(k*T))]))), {H, 0, 6*10^-22}])
fit = ResourceFunction["MultiNonlinearModelFit"][Rationalize[{real, imag}, 0], {dynamicReal[T, s, d, A, t],dynamicImag[T, s, d, A, t]}, Rationalize[{{t, 1.0*10^-12}, {s, 0.25}, {d, 8*10^-23}, {A, 1.0*10^-4}}, 0], {T}]
fit["ParameterTable"]
Show[ListPlot[{real, imag}], Plot[{fit[1, x], fit[2, x]}, {x, 0, Max[real[[All, 1]], imag[[All, 1]]]}, PlotRange -> All], PlotRange -> All
I am getting an error called integral and error estimates are 0 on all integration subregions. Try
increasing the value of the MinRecursion option. If value of integral
may be 0, specify a finite value for the AccuracyGoal option
dynamicImag
. Instead of the imaginary unitI
in the numerator of the integrand, I think you needExp[H/(k*x)]
$\endgroup$dynamicReal
anddynamicImag
with some reasonable values of s, d, A and t? It's always a good way to check that your fitting functions are behaving correctly. $\endgroup$