Message Boards Message Boards

0
|
5970 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Can some please help me solve the error in the file

Posted 11 years ago

HI, I am trying to fit model to data, but it is showing an error. Can someone please help me with this. I have attached the mathematica file for the reference.

Thanks, Jaydeep

Attachments:
POSTED BY: Jaydeep Yadav
4 Replies

In the line

fit = NonlinearModelFit[   data, {Model3[ka, Cc, te]}, {ka, 1.67}, {Cc, te}] 

{ka, 1.67} is supposed to be a list of parameters to vary. 1.67 is a constant.

POSTED BY: Bruce Miller

There are a couple of problems I see (note that I'm not looking at your input carefully):

  1. Model3 is a function of 2 variables. When calling our fitting function, you give it 3 variables. One of these is wrong.

    Model3[ka?NumericQ, te]

  2. You are missing a set of braces in the fitting function. It should look something like this:

    fit = NonlinearModelFit[data, {Model3[ka, te]}, {{ka, 1.67}}, {te}]

POSTED BY: Chad Knutson
Posted 11 years ago

HI, Thanks for the reply, But then usually I do the fitting procedure the same way, and it has worked earlier. I am attaching a file where it had worked fine. I am not able to find why the same code is not working in the above file. I will appreciate, if you can please help me find out my mistake.

Thanks

Attachments:
POSTED BY: Jaydeep Yadav

The error message tells you exactly what the problem is. It expects a symbol, but you gave it a real.

POSTED BY: Chad Knutson
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