I've difficulites with the NonlinearModelFit
function.
In principle Mathematica should be able to deal with complex data.
E.g. if I define the following table
set = Table[{i, (3*i^2*I + 1*I)}, {i, 0, 10}]
and perform NonlinearModelFit
, Mathematica has no problem finding the right values
NonlinearModelFit[set, (a + b*x^2*I), {a, b}, x]
(* {a -> 0. + 1. I, b -> 3. + 0. I} *)
But I need to fit some fractional functions, so I tried to fit just the inverse of the above set of data (I don't change any syntax, besides putting 1/
in front)
set = Table[{i, 1/(3*i^2*I + 1*I)}, {i, 0, 10}]
NonlinearModelFit[set, 1/(a + b*x^2*I), {a, b}, x]
Then Mathematica comes up with an error:
FindFit::nrlnum: The function value {1.-1. I,0.5-4.5 I,<<7>>,0.000152393-244.012 I,
<<1>>} is not a list of real numbers with dimensions {11} at {a,b} = {1.,1.}. >>
So now I'm confused- there is no syntax or misspelling problem – is Mathematica just not able to perform such a fractional fit? Or are there any mathematical restrictions, which I have not considered? I'm using Mathematica 7.
Comments
Post a Comment