der.m v1.0 (Nov, 2009)

Estimates first derivative of an array by using POLYFIT locally on each point ignoring NaNs!


Updated 12 Nov 2009

View License

DER Estimates the derivative of an array X with respect to its argument T: dX/dT by evaluating the slope of a polynomial fit of elements "close" to each point. This "closeness" is controlled by an optional input called window width, in turn this controls the smoothness.

>> dXdT = der(X,DT);
where X is a time series and DT its sampling interval.
>> dXdT = der(X,T);
if T is not uniform.

Other optional inputs are:
- the window width (W)
- the polynomial fit degree (DEG)
- the padding (PAD) % to improve derivatives at edges

Besides, the error of the dXdT estimate may be obtained.

Enjoy it!
Bugs reports and comments will be very appreciated!

Cite As

Carlos Adrian Vargas Aguilera (2023). der.m v1.0 (Nov, 2009) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Descriptive Statistics in Help Center and MATLAB Answers

Inspired by: Movingslope, nanderivative.m v2.1 (Jul 2009)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes