sfderiv applies the first derivative filter.

The algorithm implemented in this program is described in the paper

Pei, S.-C., and P.-H. Wang, 2001, Closed-form design of maximally flat FIR Hilbert transformers, differentiators, and fractional delayers by power series expansion: IEEE Trans. on Circuits and Systems, v. 48, No. 4, 389-398.

It is based on the Taylor expansion of the inverse sine function
$$\arcsin{x} = \displaystyle \sum_{n=0}^{\infty} \frac{(2n)!}{4^n\,(n!)^2\,(2n+1)}\,x^{2n+1}$$
which turns into an expansion of the ideal derivative filter into a chain of digital filters. The order= parameter controls the order of the expansion and the accuracy-efficiency trade-off. The following example from rsf/rsf/sfderiv shows the frequency responses and the impulse responses for differentiators of different orders

An alternative is sfigrad, which implements a simple first-order derivative. igrad is more efficient and adequate when computing derivatives of smooth functions.

Previous programs of the month