Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'define/limit variable ranges' topicStudent Support Forum > General > "define/limit variable ranges"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
07/19/13 11:40pm

Let's see if we can get something working first.

In[1]:= ff = {{1, 1.1}, {2, 3.9}, {3, 9.1}, {4, 15.9}, {5, 25.1}};
FindFit[ff, {{q, a*q^2 + b}}, {a, b}, q]

Out[2]= {a -> 1.00107, b -> 0.00823529}

In[3]:= Show[ListPlot[ff, Joined -> True],
Plot[a*q^2 + b /. {a -> 1.00107,
b -> 0.00823529}, {q, 1, 5}]]

Out[3]= ...GoodPlotSnipped...

So that shows the syntax that works when you have pairs of items in your data. Note the {{}} around the independent variable and the expression.

Now let's try the same thing with your data and your expression. I modify your FindFit example to be almost identical to the working example above.

In[4]:= LogPD = {{4.57, 1.39}, {5.60, 1.67}, {6.36, 1.79}, {7.13, 2.30}, {8.00, 3.18}};
FindFit[LogPD, {{pH, LogP - Log[1 + 10^(pKa - pH), 10]}}, {LogP, pKa}, pH]

Out[5]= {LogP -> 2.066, pKa -> 1.70472*10^7}

In[6]:= Show[ListPlot[LogPD, Joined -> True],
Plot[LogP - Log[1 + 10^(pKa - pH), 10] /. {LogP -> 2.066, pKa -> 1.70472`*^7}, {pH, 4.57, 8.0}]]

Out[6]= ...BadPlotSnipped...

That makes me think I have misunderstood the model for your data or you have a model that doesn't look like it is going to be a good fit for your data.

See if you can resolve these problems and get FindFit to find coefficients that closely match your data.

After that we can start looking at adding constraints on the parameters.

URL: ,

Subject (listing for 'define/limit variable ranges')
Author Date Posted
define/limit variable ranges Todd Topley 07/18/13 07:27am
Re: define/limit variable ranges Bill Simpson 07/19/13 11:40pm
< Previous CommentHelp | Reply To Comment | Reply To Topic