Message Boards Message Boards

1
|
1340 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Substitution of solution into formula?

Posted 3 years ago

How to automatically, not manually, insert the output values a1 and k1 of Out[3] as starting values of a2 and k2 in In[6]?

In[1]:= data1 = {{1.0, 12.}, {1.9, 10.}, {2.6, 8.2}, {3.4, 6.9}, {5.0, 5.9}};

In[2]:= model1 = a1 Exp[-k1 t];

In[3]:= fit = FindFit[data1, model1, {a1, k1}, t]

Out[3]= {a1 -> 14.3889, k1 -> 0.198208}

In[4]:= data2 = {{1.1, 11.9}, {1.8, 11.}, {2.7, 8.4}, {3.3, 6.7}, {4.9, 6.1}};

In[5]:= model2 = 1 + a2 Exp[-k2 t];

In[6]:= FindFit[data2, model2, {{a2, 14.3889}, {k2, 0.198208}}, t]

Out[6]= {a2 -> 14.3473, k2 -> 0.236929}
Attachments:
POSTED BY: Eduardo Ascolese
3 Replies

I apologize. I misspelled. (a1)1,..., (a1)100, (k1)1,...,(k1)100, (a2)1,..., (a2)100, (k2)1,...,(k2)100.

POSTED BY: Eduardo Ascolese

Thank you very much.

What if the values of "a" are 100 and the values of "k" are 100, say? That is, a1, ..., a100, k1, ..., k100.

POSTED BY: Eduardo Ascolese
Posted 3 years ago

Hi Eduardo,

Here is one way

FindFit[data2, model2, {{a2, a1 /. fit}, {k2, k1 /. fit}}, t]
POSTED BY: Rohit Namjoshi
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