Code covered by the BSD License  

Highlights from
Inverse (integrated) gradient

5.0 | 4 ratings Rate this file 40 Downloads (last 30 days) File Size: 12.4 KB File ID: #9734 Version: 1.1

Inverse (integrated) gradient


John D'Errico (view profile)


23 Jan 2006 (Updated )

Vectorized & fully sparse 1-d, 2-d, & 3-d integrated gradients

| Watch this File

File Information

The inverse of the gradient function. I've provided versions that work on 1-d vectors, or 2-d or 3-d arrays. In the 1-d case I offer 5 different methods, from cumtrapz, and an integrated cubic spline, plus several finite difference methods.

In higher dimensions, only a finite difference/linear algebra solution is provided, but it is fully vectorized and fully sparse in its approach. In 2-d and 3-d, if the gradients are inconsistent, then a least squares solution is generated.

(I'll enhance the 2-d and 3d tools if there is any interest. Currently they are set to be 2nd order methods on uniform grids.)

Please notify me of any bugs.


Inverse Gradient inspired this file.

This file inspired Piv Mat 3.02.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
04 Mar 2015 hamideh F


Comment only
15 May 2013 Martyn

Martyn (view profile)

There is a bug in intgrad3 where the parameter checks in lines 84 to 96 check nargin against values that are -1 of the correct value, ie on line 84 (nargin<3) should be (nargin<4), etc.

Comment only
01 Jan 2013 garima

garima (view profile)

I have tried your tool but it perhaps fails in case of functions with (x+iy)...plz chek and update...

17 Mar 2007 Uland Wong  
07 Jul 2006 F Moisy

Thank you for this excellent tool. Should be included in Matlab.

27 Jan 2006 John D'Errico

I caught the bug in the example usage for the release I submitted this morning. Good point too about author and creation dates. I'll add them to all my files. Thanks, John

Comment only
27 Jan 2006 Sergei Koptenko

Rating =1 must be substantiated according to the ?Guidelines for Reviewing a Submission?- (provide specific information on what you like and dislike about the submission, use examples to illustrate your point... etc..). I would suggest to File Review Team to remove all ratings=1 that do not have specific critique as irrelevant and misleading.

Now, the specific critique :-)
1) help files are good, however they lack information about author and creation date.
2) minor -in intgrad2 help section function is called intgrad

27 Jan 2006

This release upgrades the finite difference approximations used in intgrad1. Higher accuracy is now achieved for non-uniform spacing, as well as the addition of a 4th order method.

02 Jan 2013 1.1

Fixed bug for complex inputs

Contact us