I have diffusion equation with the initial/boundary conditions:
eq = D[c[x, t], t] - d * D[c[x, t], {x, 2}] == 0;
ibc = {c[x, 0] == If[x != 0, 0, 1], c[0, t] == 1, Derivative[1, 0][c][0.3, t] == 0};
where 'd' is the diffusion coefficient.
Also I have about 500 data points of the diffusion process (in 3D form, C(x,t)). I'd like to estimate the diffusion coefficient.
I've tried to use FindFit to estimate value of the 'd' in two ways: 1)
sol1 = ParametricNDSolve[{eq, ibc}, {c[x,t]}, {x, 0, 0.3}, {t, 0, 3.5}, {d}]
fit1 = FindFit[pts, sol1[d][c[x,t], d, {x,t}]]
2) (based on the Mathematica's Documentary Center -> FindFit)
model[d_?NumberQ] := (model[d] = First[c[x,t] /. NDSolve[{eq, ibc}, {c[x,t]},{x, 0, 0.3}, {t, 0, 3.5}]]
fit2 = FindFit[pts, model[d][c[x, t]], d, {x, t}]
In both cases I get an error:
FindFit::nrlnum: The function value {-0.437097+c[c[0.05812,0.116667]],-0.5016+c[c[0.05812,0.233333]],<<47>>,-0.862967+c[c[0.06838,2.4525]],<<548>>} is not a list of real numbers with dimensions {598} at {d} = {1.}. >>
I would appreciate any help in rebuilding the code.
Thanks!
c[x,t]
without the curly braces. Your syntax as it stands is incorrect. $\endgroup$