Estimate the drift and diffusion function numerically I have a 1D problem as following
$$\frac{\partial f}{\partial t} = \frac{\partial}{\partial x} \Big[ \frac{1}{2} \frac{\partial (g(x) f)}{\partial x} -\mu(x)f \Big]$$
I have a time-series of function $f$ already, for example, $\{f(x,t_i) \}_{i=0}^N$ for $t_0 <t<t_N$. My question is how to find $g(x)$ and $\mu(x)$. Both numerical and analytical answers are acceptable but numerical is preferred.
Thanks!
 A: Here's one way to do parameter estimation for PDE models. See: Parameter Estimation of Partial Differential Equation Models by Xun et al.
So for a PDE like
$$
\mathscr{F}\left( 
\vec{x}, f, \frac{\partial f}{\partial x_1}, \frac{\partial f}{\partial x_2}, \ldots, \frac{\partial^2 f}{\partial x_i\partial x_j}, \ldots; \vec{\theta}
\right) = 0
$$
you approximate $f$ as a linear combination of B-spline functions, with coefficients given by $\vec{\beta}$.
In this case, you need a form for $g$ and $\mu$ so that they can be determined by estimating $\vec{\theta}$; for instance, you could use splines to approximate them, parameterized by $\vec{\theta}$.
Then you can do iterative regularized least squares fitting to estimate $\vec{\theta}$ and $\vec{\beta}$. (The paper above also considers an MCMC-based Bayesian approach with explicit noise modelling).
Alternatively, a practical method is to use Mathematica. Use ParametricNDSolveValue to generate a PDE model and then use NonlinearModelFit to do parameter estimation and fitting. 
