Fitting a Gaussian locally (instead of Taylor series) based on derivatives

235 Views Asked by At

With the Taylor series one can locally approximate (t a point of expansion) any function. Often, the Taylor series is used until the quadratic term, using the gradient of the original function (1st derivative) and the Hessian matrix (2nd derivative). No parametric curve fitting is required. Now I would like to use a single Gaussian to approximate an original function locally. Because of my knowledge of the original function, I am sure it will fit nicely. I do not want to probe the original function and then perform parametric curve fitting. Instead, I want to use the gradient and the Hessian of the original function at the point of expansion. Can I achieve that and if yes, how?

1

There are 1 best solutions below

0
On BEST ANSWER

A typical gaussian function write $$f(x) = a\, e^{- \frac{(x-b)^2 }{ 2 c^2} }$$ For more simplicity, let us use $$f(x) = a\, e^{- c(x-b)^2 }\tag 1$$ $$f'(x)=-2 a c (x-b)\,e^{-c (x-b)^2}\tag 2$$ $$f''(x)=2 a c \left(2 c (b-x)^2-1\right)\,e^{-c (b-x)^2}\tag 3$$ and you know $(x,f(x),f'(x),f''(x))$. So, you have to solve these three equations for $(a,b,c)$.

Make the ratios $$\frac{f'(x)}{f(x)}=-2 c (x-b)\implies b=x+\frac 1{2c}\frac{f'(x)}{f(x)}\tag 4$$

Use this $b$ in the next step $$\frac{f''(x)}{f(x)}=2 c \left(2 c (b-x)^2-1\right)\implies \color{blue}{c=\frac{f'(x)^2-f(x) f''(x)}{2 f(x)^2}}\tag 5$$ which then makes

$$\color{blue}{b=x+\frac{f(x) f'(x)}{f'(x)^2-f(x) f''(x)}}\tag 6$$

Plug all of these in $(1)$ to get $$\color{blue}{a=f(x) \exp \left(\frac{f'(x)^2}{2 \left(f'(x)^2-f(x) f''(x)\right)}\right)}\tag 7$$