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_vf_angle(v,dir)
function theta = compute_vf_angle(v,dir)

if nargin<2
    dir = 1;
    if size(v,3)==1
        dir=-1;
    end
end
if dir==1
    theta = atan2(v(:,:,2),v(:,:,1));
else
    theta = cat(3,cos(v),sin(v));
end

Contact us at files@mathworks.com