Message Boards Message Boards


Fitting a very simple dataset

Posted 5 months ago
3 Replies
1 Total Likes

Hi all,

I am a beginner in Mathematica. I am trying to fit the data from a CSV file using FindFit. In doing so, I am getting the following error message

FindFit::nrjnum: The Jacobian is not a matrix of real numbers at {a} = {1.}.

My CSV file can be found attached. I wonder what is the right way of performing this task. I would like to fit my data into something of the form:

y = 1/x^{a}

My attempt so far has been

data=Import["/home/data_variance2_r \_final.csv"]
modeltwolevelsat = 1/x^a;
eq = FindFit[data, modeltwolevelsat, {a}, x]

I would appreciate if someone can help me out or give any tip on how to solve this problem. Thanks in advance.

3 Replies
Posted 5 months ago

Hi Heitor,

Look at what the function evaluates to over the data.

modeltwolevelsat[x_, a_] = 1/x^a

modeltwolevelsat @@@ data
(* Result is imaginary *)
Posted 5 months ago

Crossposted here.

Welcome to Wolfram Community! Please make sure you know the rules: Please next time link your post to the duplicated one from MSE site.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract