wolfram mathematica - FindFit returns a weird nrnum -


again!

i trying fit list of data points mathematica. problem gives me error function complex when tries fit though made assumption parameters reals , no imaginary unit in function. makes me believe it's me not knowing mathematica enough imaginary term says gets when evaluating function should considered perfect zero: 2.975219565012465*10^-753 i. did come from?

and code:

findfit[table[{x[[i]], weight[[i]]}, {i, length[weight]}], {allfunc[x, a, b, c, d, e, f, g], {a \[element] reals, b \[element] reals,  x \[element] reals, c \[element] reals, d \[element] reals,  e \[element] reals, f \[element] reals, g \[element] reals}}, {{a,  10.42}, {b, -0.05435}, {c, 7.59}, {d, 3.986}, {e, 88.19}, {f,  6.958}, {g, 104500}}, x] 

while allfunc is:

crystalball[x_, \[alpha]_, n_, \[mu]_, \[sigma]_, norma_] := if[(x - \[mu])/\[sigma] > -\[alpha], norma*exp[-((x - \[mu])^2/(2 \[alpha]^2))], norma*(n/abs[\[alpha]])^ n exp[-(abs[\[alpha]]^2/2)] (n/abs[\[alpha]] - abs[\[alpha]] - (  x - \[mu])/\[sigma])^-n]; allfunc[x_, const_, slope_, alpha_, en_, miu_, sigma_, norm_] :=  exp[const + slope*x] + crystalball[x, alpha, en, miu, sigma, norm]; 

sorry aspect of code. error is:

findfit::nrnum: function value 1.74493*10^14+2.975219565012465*10^-753 not real number @ {a,b,c,d,e,f,g} = {13.3122,0.0104586,-58.8739,3.986,87.764,6.958,104500.}. >>

i've plotted function arguments in fit range , no complex warning appeared. looked solution on internet questions people wanted complex fit, don't.

wrap function in re[] or chop[]


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -