File Exchange

image thumbnail

diffxy

version 1.2.0.0 (65.8 KB) by Darren Rowland
Second-order accurate numerical differentiation (N-dimensional)

8 Downloads

Updated 08 Nov 2010

View License

In its simplest usage DIFFXY uses a second-order accurate scheme to approximate the derivative of a vector y with respect to a vector x. It differs from existing functions in the following ways:

- returns dydx having the same size as y (unlike DIFF which reduces the dimension by 1)
- special treatment of end-points for higher accuracy
- specifically built to handle unequally spaced data

DIFFXY also has the following capabilities

- x and y can be N-dimensional arrays
- operate on chosen dimension of N-d arrays
- computes higher-order derivatives via iteration

See the Help section and demo file for examples and further information.
Please suggest any improvements/report any bugs either in the comments or via email.

Cite As

Darren Rowland (2019). diffxy (https://www.mathworks.com/matlabcentral/fileexchange/29312-diffxy), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

A generalized framework called MaxPol has been recently published and made available here
https://www.mathworks.com/matlabcentral/fileexchange/63294-maxpol-smoothing-and-differentiation-package

MaxPol provides a framework to design variety of numerical differentiation kernels with properties like:
(1) Cutoff (lowpass) design with no side-lob artifacts (for noise-robust case)
(2) Arbitrary order of differentiation
(3) Arbitrary polynomial accuracy
(4) Derivative matrix design
(5) 2D Derivative Kernels with Steering moments
(6) Intuitive examples in Signal and Image processing

jongmin

Really good and straightforward, convenient to use.

Maarten

Hi Darren,

Great script you have here. Do you have any ideas where i can find some more information about the differentiation algorithm you are using?

thanks

Maarten

Tested it for 1-dimensional data only: Easy to use, does exactly what it is expected to do. Thank you very much!

Nek Valous

@ Carlos,
Yes this will handle equally spaced data too. The formula I have used reduces to the central difference formula when the data are equally spaced, so the result is mostly the same as GRADIENT in that case.
The first example in the file demo_diffxy demonstrates the case of equally spaced points (follow the link next to 'Published MATLAB Files' above to view).
Darren

Carlos

I noticed that you specified that this file was made to handle unequally spaced data but, I was wondering if it can also handle equally spaced data? Thank you.

Updates

1.2.0.0

9 Nov 2010 - minor update to demo file to correct figure legend and screenshot

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: derivative

Inspired: DGradient

diffxy/html/