I had some code computing the second difference of a sampled signal as (x(n-1)-2x(n)+x(n+1))/(square of interval) I only needed a crude estimate of the second derivative in this case. Then I came across "five point stencils" By this method, the second difference is (-x(n-2)+16x(n-1)-30n(n)+16x(n+1)-x(n+2))/12/(square of interval) And then 5-sample Savitsky-Golay formula, which seems rather different (2x(n-2)-x(n-1)+2x(n)-x(n+1)+2x(n+2))/7/(square of interval) Are either of these "better" in any sense?

# 5-point stencil or Savitsky-Golay for differences

Started by ●April 25, 2019

Reply by ●April 25, 20192019-04-25

On Thursday, April 25, 2019 at 3:13:58 AM UTC-5, conr...@gmail.com wrote:> I only needed a crude estimate of the second derivative in this case.Not sure whether this will be helpful or not, but http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/ and http://www.holoborodko.com/pavel/wp-content/plugins/download-monitor/download.php?id=8

Reply by ●April 26, 20192019-04-26

On Thursday, April 25, 2019 at 8:35:11 PM UTC+8, Greg Berchin wrote:> > Not sure whether this will be helpful or not, but > http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/Thanks for that reference. It seems the first formula was derived for a higher-order polynomial, explaining the different coefficients.