help-octave
[Top][All Lists]
Advanced

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

Re: System of ODE - part III


From: Przemek Klosowski
Subject: Re: System of ODE - part III
Date: Wed, 3 Oct 2001 15:46:17 -0400

       Now,  is there a way to have Octave determine values for multiple 
   initial constants that are part of my model so that a value from one of 
   the integrated equations can match a specified value? Basically I want 
   to curve fit the resulting plots to my actual experimental data and have 
   Octave determine the best values for the constants that would accomplish 
   this. In the past I have used Excel's SOLVER function to accomplish this 
   task but wish to know if Octave can do the same thing.

OK, that's an interesting problem. What you need to do is non-linear fitting
of the solution to your set of differential equation to your data. NOrmally,
a nonlinear fitting problem is set up thusly: there's a function F(x;p) 
depending
on an independent variable (or several variables) x, and on some parameters p. 
You
also have some data Y measured at some points (x1, x2, ... xN).
You
are trying to find a set of parameters that minimizes the difference between
F and your data: the most-often used formula for this difference is called
chi square:

        chisq(p) = sum over all Xi  of  (F(Xi;p) - Y(Xi))^2 / (error of Y(Xi))

Note that chi squared is a function of p. Normally, F is some closed function:
e.g. often people fit gaussian peak shapes to data, where p = [A x0 sig] and
        F(x;p) = A exp(-(x-x0)^2/sig)

In your case, F(x;p) is a solution of your differential equation, and p are
the coefficients of the equation; it's just a little more difficult technically,
because there's no closed form formula for F in general--but it's the same 
concept.

Octave doesn't yet have built-in minimization package. 
http://users.powernet.co.uk/kienzle/octave/optim.html lists several choices;
for starters, you could try to use leastsq.m from
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/octave/octave/scripts/numeric/optim/

                        przemek klosowski, Ph.D. <address@hidden>  (301) 
975-6249
                        NIST Center for Neutron Research (bldg. 235), E111 
                        National Institute of Standards and Technology
                        Gaithersburg, MD 20899,      USA



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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