Code covered by the BSD License  

Highlights from
Toolbox diffc

image thumbnail
from Toolbox diffc by Gabriel Peyre
A toolbox to perform differential calculus on a matrix.

compute_hodge_decompositon(v,options)
function [a,b] = compute_hodge_decompositon(v,options)

% compute_hodge_decompositon - perform Hodge decomposition of a vector field.
%
%   [a,b] = compute_hodge_decompositon(v,option);
%
%   Compute a decomposition v=a+b
%   where a is irrotational (derive from a potential)
%   and v is iccompressible (purely rotational, divergence free).
%
%   Copyright (c) 2007 Gabriel Peyre

options.null = 0;
if isfield(options, 'bound')
    bound = options.bound;
else
    bound = 'per';
end

d = div(v,options);
U = compute_periodic_poisson(d,strcmp(bound,'sym'));
a = grad(U,options);
b = v-a;

Contact us at files@mathworks.com