help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nonlinear fitting with lg(a+x)


From: Michael Creel
Subject: Re: Nonlinear fitting with lg(a+x)
Date: Fri, 13 Mar 2009 01:55:52 -0700 (PDT)



reposepuppy wrote:
> 
> Hello,
> I'm a college student who is attending a physical chemistry class now, and
> we're required to process the data obtained from experiments we've done to
> reach a plausible conclusion every week. 
> This time, I've got 2 columns of data, and one of them is the
> concentration of a solution [c], the other the surface tension of the
> solution [r]; the task is to draw the curve representing the function of
> F(c,r)=0, and use it to draw the curve representing the function of F(c,
> dr/dc)=0 to reach some conclusion。I found out on the Internet that there
> is a function between them stated as :
>                              r=r0[1-a*lg(1+c/b)]
> where r0 is the surface tension when there is no solute in the solution,
> or in other words, c=0; it could be measured during the experiment. The
> constants a and b could be determined by making a nonlinear fitting using
> the data I've got.
> That's the question: I don't know how to transform this nonlinear function
> into a linear one; I could only make it (1-r/r0)=a*lg(b+c)-a*lg(b) and
> using the trial-and-error method(*See below) to find out what a and b are.
> But the error is too much for me(about 30% away from the theoretical one).
> 
> Does anyone know how to solve this fitting problem using solely Octave? 
> Thanks for help!
> 
> * The trial-and-error method I used is here, using Microsoft Excel (I
> could use Octave only to deal with some integration problem and linear
> fitting...):
> First, input the data into Excel and draw a XY scattered diagram, where
> X=(1-r/r0) and Y=lg(b+c). A linear distribution of dots would appear if
> the value of b was right.
> Second, calculate the R^2(the square of correlation coefficient) . It
> would be a value very close to 1 if the value of b was right.
> Third, change the b value until I can't make the R^2 higher. First try
> from 0 to 10, and find out the optimal value, and minimize the scale by 10
> fold and try again... I tried from 0 to 2, and found out the R^2 will be
> the biggest when b was 0.6; and I tried from 0.50 to 0.70 and I found out
> it's 0.59~0.62(the R^2 will not change any more during this range).  
> 

You don't need to linearize anything, just use nonlinear least squares to
minimize the function

     sum_over_observations [ r-r0[1-a*lg(1+c/b)] ]^2  with respect to the
unknown constants. 

If you linearize and then estimate, the resulting estimator is biased and
inconsistent. All you need to do is write Octave code to calculate the
objective function. Then you can use one of the available minimizers to get
the estimates. Octave provides sqp, which can handle this problem.



-- 
View this message in context: 
http://www.nabble.com/Nonlinear-fitting-with-lg%28a%2Bx%29-tp22492005p22492425.html
Sent from the Octave - General mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]