How to calculate the mean integrated curvature of an ellipsoid?
I am using the following code to compute the surface area, mean integrated curvature, and Euler characteristic of the ellipsoid parameterized by r(x,y). Here ‘x’ and ‘y’ represent the angles $theta$ and $phi$ in spherical coordinates. The code is
clc; clear;
%ellipsoid radii
a=value1; b=value2; c=value2;
syms x y
%parametric vector equation of the ellipsoid
r=[a*cos(y)*sin(x), b*sin(x)*sin(y), c*cos(x)];
%partial derivatives
r_x=diff(r,x);
r_xx=diff(r_x,x);
r_y=diff(r,y);
r_yy=diff(r_y,y);
r_xy=diff(r_x,y);
%normal vector to the surface at each point
n=cross(r_x,r_y)/norm(cross(r_x,r_y));
%coefficients of the second fundamental form
E=dot(r_x,r_x);
F=dot(r_x,r_y);
G=dot(r_y,r_y);
L=dot(r_xx,n);
M=dot(r_xy,n);
N=dot(r_yy,n);
A=E*G-F^2;
K=((E*N)+(G*L)-(2*F*M))/A;
H=(L*N-M^2)/A;
dA=sqrt(A);
dC=K*dA;
dX=H*dA;
%converting syms functions to matlab functions
dA_=matlabFunction(dA); dC_=matlabFunction(dC); dX_=matlabFunction(dX);
% numerical integration
S = integral2(dA_, 0, 2*pi, 0, pi); %total surface area
C = (1/2)*integral2(dC_, 0, 2*pi, 0, pi); % medium integrated curvature
X = (1/(2*pi))*integral2(dX_, 0, 2*pi, 0, pi); % Euler characteristics
S and X give me very well, but the problem is with C, which always gives me very small, of the order of 1e-16 to 1e-14, which is absurd since C must be of the order of 4*pi*r (for the case of a sphere a=b=c=r). Could someone tell me what is wrong?I am using the following code to compute the surface area, mean integrated curvature, and Euler characteristic of the ellipsoid parameterized by r(x,y). Here ‘x’ and ‘y’ represent the angles $theta$ and $phi$ in spherical coordinates. The code is
clc; clear;
%ellipsoid radii
a=value1; b=value2; c=value2;
syms x y
%parametric vector equation of the ellipsoid
r=[a*cos(y)*sin(x), b*sin(x)*sin(y), c*cos(x)];
%partial derivatives
r_x=diff(r,x);
r_xx=diff(r_x,x);
r_y=diff(r,y);
r_yy=diff(r_y,y);
r_xy=diff(r_x,y);
%normal vector to the surface at each point
n=cross(r_x,r_y)/norm(cross(r_x,r_y));
%coefficients of the second fundamental form
E=dot(r_x,r_x);
F=dot(r_x,r_y);
G=dot(r_y,r_y);
L=dot(r_xx,n);
M=dot(r_xy,n);
N=dot(r_yy,n);
A=E*G-F^2;
K=((E*N)+(G*L)-(2*F*M))/A;
H=(L*N-M^2)/A;
dA=sqrt(A);
dC=K*dA;
dX=H*dA;
%converting syms functions to matlab functions
dA_=matlabFunction(dA); dC_=matlabFunction(dC); dX_=matlabFunction(dX);
% numerical integration
S = integral2(dA_, 0, 2*pi, 0, pi); %total surface area
C = (1/2)*integral2(dC_, 0, 2*pi, 0, pi); % medium integrated curvature
X = (1/(2*pi))*integral2(dX_, 0, 2*pi, 0, pi); % Euler characteristics
S and X give me very well, but the problem is with C, which always gives me very small, of the order of 1e-16 to 1e-14, which is absurd since C must be of the order of 4*pi*r (for the case of a sphere a=b=c=r). Could someone tell me what is wrong? I am using the following code to compute the surface area, mean integrated curvature, and Euler characteristic of the ellipsoid parameterized by r(x,y). Here ‘x’ and ‘y’ represent the angles $theta$ and $phi$ in spherical coordinates. The code is
clc; clear;
%ellipsoid radii
a=value1; b=value2; c=value2;
syms x y
%parametric vector equation of the ellipsoid
r=[a*cos(y)*sin(x), b*sin(x)*sin(y), c*cos(x)];
%partial derivatives
r_x=diff(r,x);
r_xx=diff(r_x,x);
r_y=diff(r,y);
r_yy=diff(r_y,y);
r_xy=diff(r_x,y);
%normal vector to the surface at each point
n=cross(r_x,r_y)/norm(cross(r_x,r_y));
%coefficients of the second fundamental form
E=dot(r_x,r_x);
F=dot(r_x,r_y);
G=dot(r_y,r_y);
L=dot(r_xx,n);
M=dot(r_xy,n);
N=dot(r_yy,n);
A=E*G-F^2;
K=((E*N)+(G*L)-(2*F*M))/A;
H=(L*N-M^2)/A;
dA=sqrt(A);
dC=K*dA;
dX=H*dA;
%converting syms functions to matlab functions
dA_=matlabFunction(dA); dC_=matlabFunction(dC); dX_=matlabFunction(dX);
% numerical integration
S = integral2(dA_, 0, 2*pi, 0, pi); %total surface area
C = (1/2)*integral2(dC_, 0, 2*pi, 0, pi); % medium integrated curvature
X = (1/(2*pi))*integral2(dX_, 0, 2*pi, 0, pi); % Euler characteristics
S and X give me very well, but the problem is with C, which always gives me very small, of the order of 1e-16 to 1e-14, which is absurd since C must be of the order of 4*pi*r (for the case of a sphere a=b=c=r). Could someone tell me what is wrong? ellipsoid, curvature, surface, ellipsoidal fit MATLAB Answers — New Questions