I tried to fit my data (see bellow) with the following code. It works but I get the following message :
NonlinearModelFit::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations.
I changed the number of iteration from 100 to 200 or more using MaxIterations
but style have the problem. So I am not sure about the accurancy of my fit...even if it works.
data = Import["https://pastebin.com/raw/ADajyTYF", "TSV"]
(* data = ReadList[file, Number, RecordLists -> True]; *)
dataT = Transpose[data];
dataT = {10*dataT[[1]], dataT[[2]]};
error = Transpose[data][[3]];
data = Transpose[dataT];
nmax = Length[data];
mu0 := 4*Pi*10^(-7);
Ms := 3.41; \
DD:= 2*10^(-3) \
lM = 10^9*Sqrt[2*A*mu0/Ms^2]
lD[DD_] := 10^9*2*DD*mu0/Ms^2
lD[0.003]
h2[Hp_, q_, RH_] := Hp^2/(1 + q^2*RH^2)^2
Heff[q_, H_, A_] := H + 2*A/(Ms/mu0)*q^2*10^(18)
p[q_, H_, A_] := Ms/Heff[q, H, A] \
nenner[q_, H_, DD_, A_] := 1 - p[q, H, A]^2*lD[DD]^2*q^2
chi[Hp_, q_, H_, DD_, RH_, A_] := (4*p[q, H, A]^3*h2[Hp, q, RH]*lD[DD]*q)/nenner[q, H, DD, A]^2
singlefit2 =
NonlinearModelFit[data,
chi[Hp, q, 5, DD, RH,
A], {{Hp, 2000}, {DD, 0.001}, {RH, 15}, {A, 10*10^(-12)}}, q,
Weights -> error, MaxIterations -> 100];
singlefit2["BestFitParameters"];
singlefit2["EstimatedVariance"];
singlefit2["ParameterErrors"];
singlefit2["ParameterConfidenceIntervals"];
MatrixForm[singlefit2["CorrelationMatrix"]];
Print[singlefit2["ParameterTable"]];
Ms
,mu0
,h2
, andlD
? $\endgroup$Import
from. You should include any clarification in your question (please edit). Also give typical values for your constant parameters, we can't reproduce your problem without that. If you expect to inspire anybody to volunteer their time to look at your problem, then you should help us as much as possible. $\endgroup$