# Message Boards

Posted 9 years ago
5697 Views
|
6 Replies
|
4 Total Likes
|
 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:
6 Replies
Sort By:
Posted 9 years ago
 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 9 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 9 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 errorThanks, Attachments:
Posted 9 years ago
 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 9 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 9 years ago
 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.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.