The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: surface area of pdedemo3
Replies: 5   Last Post: Jul 2, 2013 4:16 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan Weiss

Posts: 1,430
Registered: 11/27/08
Re: surface area of pdedemo3
Posted: Jun 25, 2013 11:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/24/2013 2:25 PM, Steven Finch wrote:
> What is the surface area of the saddle surface in
> ? 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:

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;

I ran this and got:
a = trianglearea(t,p,u)

a =


This isn't so much bigger than the area of the underlying circle, pi.

Alan Weiss
MATLAB mathematical toolbox documentation

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.