Greetings...

Tuesday, July 3, 2012

Tradeoff using central finite differences

Arggg! (But yay!) Well my collaborator and I finally figured out why the spectra we were computing were unexpectedly rolling off in the higher wavenumber end. We were calculating spectra of the derivative of our data series, and were using central finite differences to approximate that derivative. We'd figured that central differences were more accurate than forward differences and so we were using those (via Matlab's gradient() function), but we realized - ahem, in hindsight - that there's an important tradeoff to be aware of there. Since the central differences approximate the derivative using the point before and after the present point, it's effectively averaging over three points, and gives you a low-pass filtered version of the derivative. Forward (and backward) first finite differences do this too but over fewer points (two instead of three) so it's not so big an effect. The central diffs caused a big enough effect to be a problem in our work, while the forward diffs do not. Note it depends what aspect of the derivative is most important to you though - phase offset vs frequency rolloff.

In the end we computed the derivative more directly anyway by transforming to the wavenumber domain and multiplying by ik, just to avoid the whole issue. At any rate, I noticed Terry Bahill (retired from Univ Arizona) has a nice brief paper that sums it up well. @#$%, can't believe I didn't notice this earlier...