Fitting a wave (data A) to a differential equations which is expressed by two waves (data A and data B).
Nori
Can I fit a set of data with a differential equation which is expressed as a function of two waves?
For example, assume a sequential decay reaction (A -> B -> C) whose decay rates are w0 and w1. Temporal evolutions of A and B had been measured. So I have three data wave, time, A, and B.
Now then, I’d like to determine the rates of w0 and w1 by fitting.
Fitting the A to a differential equation (dA/dt = -w0*A) is easily performed because the differential equation contains one wave (A).
I use following procedure:
Function Integral_Fit_A(pw, yw, xw) : FitFunc
Wave pw
Wave yw
Wave xw
yw[0] = pw[0]
IntegrateODE /X=xw Rate_equation_A, pw, yw
End
Function Rate_equation_A(pw, tt, Cw, dAdt)
Wave pw
Variable tt
Wave Cw
Wave dAdt
dAdt[0] = -pw[1]*Cw[0]
End
Wave pw
Wave yw
Wave xw
yw[0] = pw[0]
IntegrateODE /X=xw Rate_equation_A, pw, yw
End
Function Rate_equation_A(pw, tt, Cw, dAdt)
Wave pw
Variable tt
Wave Cw
Wave dAdt
dAdt[0] = -pw[1]*Cw[0]
End
Type in command line “FuncFit/L=200 Integral_Fit_A Coef_A Data_A /X=time /D” performed fitting. (Coef_A is parameter wave.)
On the other hands, the case of B is difficult. I should fit the data B to a following differential equation:
dB/dt = +w0*A – w1*B.
Since above equation contains two waves (A and B), which make it impossible to treat in the same way as in the case of A.
Can anyone tell me the idea of solution or related issues in the forum?
Any comment will be appreciate!
By the way, I could have solved this problem by using “Integrated rate equations” and Global Fit, but I’d like to determine the rates with differential equations with numerical integration for my study.
Thank you,
Nori
To do that, you need to make a temporary wave with two columns and the appropriate number of rows. Then extract the appropriate column into the yw wave. It will look something like this (warning- not compiled or tested in any way):
Wave pw
Wave yw
Wave xw
Make/D/FREE/N=(numpnts(yw), 2) solution
solution[0][0] = pw[0]
solution[0][1] = something else, pw[1]?
IntegrateODE /X=xw Rate_equation_A, pw, yw
yw = solution[][1] // assuming column 1 is the appropriate part of the solution
End
Note that if the first two elements of pw contain the initial conditions, then the two lines that fill in initial conditions can be made into one:
solution[0][] = pw[q]
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
October 15, 2012 at 01:41 pm - Permalink
Making a temporary matrix seems to solve the problem.
I'll report the details after I do it.
October 17, 2012 at 06:25 pm - Permalink