A few weeks ago I asked a question about manipulating parameters in NDSolve (Looping with NDSolve?) , and received some very helpful advice about the manipulate environment; now I want to take the result of these varying parameters and fit them to lab data. I have a series of equations to be solved, and two unknown variables $kme$ and $kmn$. I specify a range for these and a step size. The following code outlines shows what's happening; I solve am initial PDE ($Ox$ ) and use that result to solve two further PDEs, $Ef$ and $Eb$. Both of these depend on $kme$ and $kmn$, and I am interested in the output of $Eb$. The following code outlines what I'm doing so far - apologies in advance, the equation inside the manipulate command is extremely ugly!
(*Some constants used here*)
a = 7.5*10^-7;
omega = 3.0138*10^7;
Do2 = 2*10^-9;
po = 100;
ro = 300*10^-6;
micron = 1*10^-6;
k = 1;
De = 5.5*10^-11;
eo = 100;
qm = 10^-4;
(*Then we solve an initial equation and take values from it... *)
s = Quiet[NDSolve[{D[Ox[r, t], t] - Do2*(D[Ox[r, t], r, r] + (2/r)*(D[Ox[r, t], r])) + (a*
omega)*((Ox[r, t])/(Ox[r, t] + k)) == 0, Ox[r, 0] == 0,
Ox[micron, t] == 0, Ox[ro, t] == po},
Ox, {r, micron, ro}, {t, 0, 14400}]];
p = Ox /. First[s];
(*Then we set up our other complicated expression in the MANIPULATE environment; *)
Quiet[Manipulate[Plot[Evaluate[Eb1[r, 14400] /. NDSolve[{D[Eb1[r, t], t] -
qm*((kme)/(kme + p[r, t])*((p[r, t])/(p[r, t] + kmn)))*
First[Evaluate[Ef1[r, t] /. NDSolve[{D[Ef1[r, t], t] -
De*(D[Ef1[r, t], r, r] + (2/r)*(D[Ef1[r, t], r])) + qm*((kme)/(kme +
p[r, t])*((p[r, t])/(p[r, t] + kmn)))*Ef1[r, t] ==
0, Ef1[r, 0] == 0, Ef1[micron, t] == 0, Ef1[ro, t] == eo},
Ef1, {r, micron, ro}, {t, 0, 14400}]]] == 0, Eb1[r, 0] == 0}, Eb1, {r, micron, ro}, {t, 0, 14400}]], {r,
micron, ro}, PlotRange -> All], {kme, 0.1, 60, 0.1}, {kmn, 0.1, 60, 0.1}]]
Getting this far gives me a workable manipulate environment; now I have some lab data I want to compare to this output. I have 600 values of $Kmn$ and 600 values of $Kme$ - is it possible to "output" the result for each of these in some automated fashion to compare it against the lab data? Either in a format I can use inside Mathematica or an interpolating function for each that can be exported to MATLAB / excel etc? I would be very grateful for any guidance on how to do this and the syntax!
NDSolve, thenParametricNDSolvemay be of use as it was here. – bobthechemist Feb 17 '14 at 19:04Plot[]the function you have above and thenListPlot[]the corresponding data.Showwill superimpose the two plots. – bill s Feb 17 '14 at 19:16Exportand you can send more complex information between Mathematica and Matlab using MatLink. http://matlink.org/ – bill s Feb 18 '14 at 19:57