File Exchange

image thumbnail

Toolbox diffc

version (1.18 MB) by Gabriel Peyre
A toolbox to perform differential calculus on a matrix.


Updated 27 Jun 2009

View Version History

View License

See HTML help file for information about the content (see below in 'Published HTML files').

Copyright (c) 2008 Gabriel Peyre

Cite As

Gabriel Peyre (2021). Toolbox diffc (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)


Maybe tianyu fu is right.When I replaced the codes computing the divergence and the curl by my own codes, it worked.
But the codes really enlightened me.Thank you very much.


tianyu fu

@Will Morrison, I think the codes you compute the divergence and the curl are wrong. The correct code is [curlz,cav] = curl(x,y,a(:,:,2),a(:,:,1)); and
d = divergence(x,y,b(:,:,2),b(:,:,1));

Will Morrison

Looks like the Hodge Helmholtz decomposition does not work for all vector fields. for example, the curl-free and divergence-free parts in the below example do not have zero curl and divergence.

options.bound = 'per';
mesh_size = 0.1;
xp = -2.05:mesh_size:2.05;
yp = -2.05:mesh_size:2.05;
f = x.^2 - y.^2;
fn = sqrt(fx.^2 +fy.^2);
[a,b] = compute_hodge_decompositon(cat(3,fx./fn,fy./fn),options);
[curlz,cav] = curl(x,y,a(:,:,1),a(:,:,2));
surf(x, y, curlz)
d = divergence(x,y,b(:,:,1),b(:,:,2));
surf(x, y, d)

Maider Marin

I try several test files and none of them work, I try test_structure_tensor.m and two other more and I could not make them work. Functions lack documentation within themself. I have to go to a help page to understant the input and outbuts of the functions. I also have the same error that Walid report and many others. If you have the time please correct them this is really a good effort that is not visible since there are some small errors.

Sheraz Khan

Walid Kamoun

I AM trying to run it but it keeps on outputting "Undefined function or method 'getoptions' for input arguments of type 'struct'."

Truc Phan

it's really helpful. We do not need to again and again calculate those time-consuming functions

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

Community Treasure Hunt

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

Start Hunting!