1
$\begingroup$

I have points $\{p_0, p_1, ... p_n\}$, I create a discrete derivative consisting of $\{d_0, d_1, ..., d_{n-1}\}$ like this: $d_k=p_{k+1}-p_k$. I'd like to choose a point in the original signal by exploring the derivative. But after I find a specific point $d_k$, which point from the original set should I choose: $p_k$ or $p_{k+1}$? It looks like I can't really choose between them.

Similarly I explore 2nd derivative for inflection points. But in 2nd derivative I'm guessing that $p_{k+1}$ is a sensible choice because it's a midpoint out of 3 participants ($p_k, p_{k+1}, p_{k+2}$). Though this is still not perfect because of the 1st and last points in the set.

What are possible strategies to resolve this ambiguity?

$\endgroup$
  • $\begingroup$ that depends on how you calculated the discrete derivative! How did you do that? $\endgroup$ – Marcus Müller May 10 at 12:25
  • $\begingroup$ Huh, I thought there was only 1 way, sorry. Added the algorithm. $\endgroup$ – Stanislav Bashkyrtsev May 10 at 13:13
2
$\begingroup$

Numerical signals are discrete and finite. So you are likely to hit issues either on end-points or discrete locations. I won't treat end-points here.

If you use only one operator, many signal processing folks care relatively little about a shift, as long as it is known, and constant. Here, the two-point derivative yields a $0.5$-point shift. You can consider that the derivative is valid at some mid-point. And you can interpolate it an integer locations if needed. Smoothing first can help limit a too-high fluctuations of differences.

A classical option is to choose an odd-length derivative operator. The three-point derivative writes:

$$ d_3[k] = (p[k+1]-p[k-1])/2$$

and gives you an information at the center of the schemes. Indeed, it coincides with the average of the left- and the right two-points skewed differences: $ d_2[k] = p[k]-p[k-1]$ and $ d_2[k+1] = p[k+1]-p[k]$, since:

$$d_3[k] = (d_2[k] +d_2[k+1])/2$$

Many domains uses such schemes, and name them differently. To better find resources, some uses other terms, like generic ones, like "Finite difference coefficients", or specific ones, like "five-point stencil" or $n$-point gradient/Laplacian. One example is:

$$ d_5[k] = (p[k+2]- 8p[k+1] + 8p[k-1]-p[k-2])/12$$

The above thinking extends to higher order derivatives. One can further constraints methods using data properties, knowledge of noise, additional penalties, etc. To start with, some literature on numerical derivatives:

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.