|
Re: surface area of pdedemo3
Posted:
Jun 25, 2013 11:07 AM
|
|
On 6/24/2013 2:25 PM, Steven Finch wrote: > What is the surface area of the saddle surface in > http://www.mathworks.com/help/pde/examples/minimal-surface-problem-on-the-unit-disk.html > > ? The Matlab code will almost surely contain the line > [ux,uy]=pdegrad(p,t,u) > and it will help me to see how ux, uy & mesh are numerically > integrated to give the answer. Thank you very much!
I am sorry to say that the code I came up with doesn't use pdegrad at all. But maybe it will satisfy you.
I think the easiest way to estimate the surface area is to add up all the triangle areas that make up the surface. Each triangle is represented in the (p,t) data structure that you can find described here: http://www.mathworks.com/help/pde/ug/mesh-data.html
To find the area of a 3-D triangle whose point coordinates are point = (px, py, u), make vectors v1 = point2 - point 1, v2 = point3 - point1, and use the formula
area = 1/2 * sqrt((v1(2)*v2(3) - v1(3)*v2(2))^2 + (v1(3)*v2(1) - v1(1)*v2(3))^2 + (v1(1)*v2(2) - v1(2)*v2(1))^2)
So here is a function that calculates the area of the surface:
function a = trianglearea(t,p,u) % Compute the total areas of the 3-D triangles t, whose x and y coordinates % are in p(t), and whose height is in u(p(t)).
a = 0; for i = 1:size(t,2) % two vectors v1 = [p(:,t(2,i));u(t(2,i))] - [p(:,t(1,i));u(t(1,i))]; v2 = [p(:,t(3,i));u(t(3,i))] - [p(:,t(1,i));u(t(1,i))]; smm = (v1(2)*v2(3) - v1(3)*v2(2))^2 + (v1(3)*v2(1) - v1(1)*v2(3))^2 + ... (v1(1)*v2(2) - v1(2)*v2(1))^2; a = a + sqrt(smm)/2; end
I ran this and got: a = trianglearea(t,p,u)
a =
3.8196
This isn't so much bigger than the area of the underlying circle, pi.
Alan Weiss MATLAB mathematical toolbox documentation
|
|