image thumbnail

curvature(S)

version 1.0.0.0 (1.16 KB) by Thomas Atta-Fosu
Fast and efficient computation of the Gaussian and Mean curvatures of a surface S = f(x,y).

365 Downloads

Updated 29 May 2015

View License

[K,H] = CURVATURE(S) computes the gaussian and mean curvatures of the
surface S defined by S = f(x,y), where (x,y) is the
rectangular grid on which f is defined.

Example: Define gaussians on a rectangular grid, and find its
curvatures:
f = @(mu1,mu2,s1,s2,x,y) exp(-(x-mu1).^2/(s1.^2)-(y-mu2).^2/(s2.^2));
[X,Y] = meshgrid(linspace(-5,5,200));
S = f(-2,0,2,2,X,Y) - f(2,0,2,2,X,Y)
figure; mesh(S);
[K,H] = curvature(S);
figure;mesh(K); title('Gaussian Curvature','FontSize',20);
figure;mesh(H); title('Mean Curvature','FontSize',20);

Cite As

Thomas Atta-Fosu (2021). curvature(S) (https://www.mathworks.com/matlabcentral/fileexchange/51013-curvature-s), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
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!