I'm trying to use NonlinearModelFit to fit the data:
Data = {{2.046204620462046`, 1.274347668`}, {2.012987012987013`,
1.131369542`}, {1.984`, 0.939944276`}, {1.952755905511811`,
0.721156437`}, {1.9224806201550388`,
0.614591638`}, {1.8931297709923665`,
0.572324748`}, {1.8674698795180722`,
0.536605273`}, {1.8397626112759644`,
0.49948005`}, {1.8128654970760234`,
0.478452409`}, {1.7867435158501441`,
0.455583518`}, {1.7613636363636365`,
0.439702881`}, {1.7342657342657342`,
0.411870668`}, {1.712707182320442`,
0.365204419`}, {1.6870748299319729`,
0.303633546`}, {1.6666666666666667`,
0.232056102`}, {1.6445623342175066`,
0.140710942`}, {1.6230366492146597`,
0.070744185`}, {1.6020671834625324`,
0.035633753`}, {1.597938144329897`, 0.044761696`}};
fit = NonlinearModelFit[Data, B/(
1 + g (x - (1.42 + Ea))^(-3/2)), {B, g, Ea}, x]
which gives:
NonlinearModelFit::nrlnum: "The function value {-1.22471-0.217191\ I,-1.0682-0.243262\ I,-0.863406-0.265857\ I,-0.628591-0.289822\ I,<<12>>,0.26533 -0.472365\ I,0.318041 -0.47811\ I,0.312374 -0.479155\ I}\n is not a list of real numbers with dimensions {19} at {B,g,Ea} = {1.,1.,1.}."
The function I am using to fit my data gets imaginary values for some values of the parameters. But how can I force Mathematica to avoid these values?