3
$\begingroup$

I have two data sets which go:

datajapan = {{3.22, 0.0149}, {4.7457, 0.06081}, {6.053, 
0.1276}, {7.143, 0.211}, {7.9418, 0.3112}, {8.523, 0.411}, {9.322, 
0.515}, {9.975, 0.624}, {10.847, 0.736}, {11.50, 0.84}, {12.445, 
0.937}, {13.825, 0.94}, {14.48, 0.837}, {14.99, 0.711}, {15.20, 
0.587}, {15.57, 0.46}, {16.00, 0.336}, {16.44, 0.211}, {17.167, 
0.0984}}
JP = ListPlot[datajapan]

datajapan2 = {{11.937, -0.031}, {10.629, -0.0853}, {9.467, -0.17},
{8.596, -0.26}, {7.869, -0.356}, {7.2154, -0.469}, {6.489, -0.594},
{5.835, -0.7197}, {5.036, -0.836}, {4.237, -0.94}, {3.365, -1.02},
{2.058, -0.96}, {1.404, -0.8448}, {0.968, -0.719}, {0.75, -0.595},
{0.46, -0.469}, {0.388, -0.302}, {0.315, -0.177}, {-0.121, -0.052}}
JP2 = ListPlot[datajapan2]

And two equations:

Butler = 
ParametricNDSolve[{y'[
x] == (kf*(1 - 0.02*ka*Exp[y[x]])*Exp[0.5*(x - y[x])] - 
kf*0.02*ka*Exp[y[x]]*Exp[0.5*(y[x] - x)])/(10^(-9)*ka*
Exp[y[x]]), y[-8] == 0}, y, {x, -8, 19}, {ka, kf}]
Butlerback = 
ParametricNDSolve[{y'[
x] == (kf*(1 - 0.02*ka*Exp[y[x]])*Exp[0.5*(x - y[x])] - 
kf*0.02*ka*Exp[y[x]]*Exp[0.5*(y[x] - x)])/(-10^(-9)*ka*
Exp[y[x]]), y[19] == 3.9 + Log[1/ka]},
y, {x, -8, 19}, {ka, kf}]

They have common parameters ka and kf. I need to fit this data with the next equations simultaneously:

(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x]/.Butler
-(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x]/.Butlerback

I know how to do it by my own hands. I mean, I do following things. Plot these two graphics and datasets together and watch whether they fit each other or not (using some initial parameters):

Show[{Plot[
Evaluate[
Table[-(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x] /. 
Butlerback, {ka, 0.0001, 0.0011, 0.0002}, {kf, 0.000000015, 
0.0000000151, 0.0000000001}]], {x, -8, 19}], 
Plot[Evaluate[
Table[(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x] /. 
Butler, {ka, 0.0001, 0.0011, 0.0002}, {kf, 0.000000015, 
0.0000000151, 0.0000000001}]], {x, -8, 19}], JP2, JP}, 
PlotRange -> All]

this all looks like this:

enter image description here Then I see that I need to increase ka and to decrease kf to it better.

Show[{Plot[
Evaluate[
Table[-(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x] /. 
Butlerback333, {ka, 0.0083, 0.0085, 0.0002}, {kf, 0.0000000017, 
0.00000000171, 0.00000000001}]], {x, -8, 19}], 
Plot[Evaluate[
Table[(0.130)*ka*Exp[y[ka, kf][x]]*y[ka, kf]'[x] /. 
Butler333, {ka, 0.0083, 0.0085, 0.0002}, {kf, 0.0000000017, 
0.00000000171, 0.00000000001}]], {x, -8, 19}], JP2, JP}, 
PlotRange -> All]

enter image description here

And I change parameters, watch curve again, and again and again till I somehow get a rather good match.

  1. I'd like computer to do it for me, more accurately.

  2. All these calculations are inappropriate because I use wrong initial conditions for Butler (y[-8] is not equal to zero). But this initial condition works somehow so I use it, but I would like computer to take last point of y[x]/.Butlerback and use this point as initial condition for Butler

I hope this time i made myself quite clear...)

$\endgroup$
6
  • $\begingroup$ There are numerous threads on simultaneous fitting on MSE. A search should find several good hits. $\endgroup$ Commented May 3, 2016 at 22:57
  • 1
    $\begingroup$ How similar is your problem to this one? $\endgroup$ Commented May 3, 2016 at 23:35
  • $\begingroup$ ...or this one? $\endgroup$ Commented May 3, 2016 at 23:35
  • $\begingroup$ Yes, quite similar, but i need to integrate from for example 19 to -8 and then turn back and integrate from -8 to 19. And the initial conditions for backward integration should bet obtained from the end point of foreward integration. I don't how to do it so i just put down my own, created by me initial conditions of backward integration. So i would like to be able to fit cyclic curve, one part of it goes from 19 to -8, then turn back and goes from -8 to 19 with appropriate initial conditions. $\endgroup$ Commented May 4, 2016 at 6:50
  • $\begingroup$ @D.Anishchenko Would a fitted sum of the functions you want to fit be a satisfactory result you can use? Something similar to this answer. See the application of that approach to your question here. $\endgroup$ Commented May 4, 2016 at 14:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.