Message Boards Message Boards

0
|
6773 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Please help me solve this error from NonlinearModelFit

Posted 10 years ago

HI, I am trying to fit a model, but I am getting an error. Please help me out of this. I have attached the mathematica file for the reference.

Thanks

Attachments:
POSTED BY: Jaydeep Yadav
6 Replies

Without working though your Model9 in detail I cannot say what's going on here. I would recommend debugging your Model9 so that it executes properly before trying it out in the NonlinearModelFit

POSTED BY: David Reiss
Posted 10 years ago

HI, I tried fixing that. But still I am getting an error. I have attached a changed file for reference. Please help me to solve the error

Thanks,

Attachments:
POSTED BY: Jaydeep Yadav
Posted 10 years ago

I can't run your notebook because I don't have the file which is imported. But the error you see, "1 is not a valid variable," is occurring because the fit parameter symbols were previously set to numerical values. For example, Cb0 is used as a fit parameter variable, but was earlier set with Cb0 = 1. The variables given to NonlinearModelFit must not have previously defined values.

POSTED BY: David Keith

Your function Model9, does not evaluate to a solution of the differential equation. E.g.,

Model9[.03, .046, .0666, .05, .1]

returns

Cb[0.1] /. {Derivative[1][Cc][t] == 
   137.344 (0.0378 Cam[t] + 0.0662 Cb[t] + 0.0378 Cbm[t] - 
      0.0028975 Cc[t]), 
  Derivative[1][Ca][t] == 20000. (-0.0229 Ca[t] + 0.0378 Cam[t]), 
  Derivative[1][Cb][t] == 
   925.926 (0.02 - 0.1091 Cb[t] + 0.0378 Cbm[t]), 
  Derivative[1][Cam][t] == 
   2472.19 (0.0229 Ca[t] - 0.0756 Cam[t] + 0.001145 Cc[t]), 
  Derivative[1][Cbm][t] == 
   2472.19 (0.0229 Cb[t] - 0.0756 Cbm[t] + 0.001145 Cc[t]), 
  Cam[0] == 0, Cbm[0] == 0, Cc[0] == 0, Cb[0] == Cb0, Ca[0] == 0}
POSTED BY: David Reiss
Posted 10 years ago

HI, Thanks for the reply. I fixed that error and now I am getting another error. can you please look into it? I have a new file attached.

Thanks,

Attachments:
POSTED BY: Jaydeep Yadav

From your output you can see that Cb0 has a value (it is 1 and is set at the top of your notebook). That is what the error is telling you. The variable that you use to fit cannot have a value.

POSTED BY: David Reiss
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