Code covered by the BSD License  

Highlights from
diffxy

Be the first to rate this file! 13 Downloads (last 30 days) File Size: 65.75 KB File ID: #29312
image thumbnail

diffxy

by Darren Rowland

 

08 Nov 2010 (Updated 08 Nov 2010)

Second-order accurate numerical differentiation (N-dimensional)

| Watch this File

File Information
Description

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
derivative
This submission has inspired the following:
DGradient

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
16 Nov 2010 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.

18 Nov 2010 Darren Rowland

@ 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

Please login to add a comment or rating.
Updates
08 Nov 2010

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

Tag Activity for this File
Tag Applied By Date/Time
derivative Darren Rowland 08 Nov 2010 12:23:11
differentiation Darren Rowland 08 Nov 2010 12:23:11
gradient Darren Rowland 08 Nov 2010 12:23:11

Contact us at files@mathworks.com