Message Boards Message Boards

0
|
3441 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Fitting a very simple dataset

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.

Attachments:
POSTED BY: Heitor Silva
3 Replies
Posted 4 years ago

Hi Heitor,

Look at what the function evaluates to over the data.

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

modeltwolevelsat @@@ data
(* Result is imaginary *)
POSTED BY: Rohit Namjoshi
Posted 4 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST Please next time link your post to the duplicated one from MSE site.

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract