Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
surface area of pdedemo3

Subject: surface area of pdedemo3

From: Steven Finch

Date: 24 Jun, 2013 18:25:08

Message: 1 of 6

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!

Subject: surface area of pdedemo3

From: Alan_Weiss

Date: 25 Jun, 2013 15:07:29

Message: 2 of 6

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

Subject: surface area of pdedemo3

From: Steven Finch

Date: 25 Jun, 2013 15:33:21

Message: 3 of 6

Here is more detail. If I append the existing Matlab PDE demo with the commands:

[ux,uy]=pdegrad(p,t,u);
pi*mean(sqrt(1+ux.^2+uy.^2))

a coarse estimate 3.8042 of the surface area is obtained. What steps can be taken to refine this numerical result? Explicit code would be helpful to me. Thank you!



"Steven Finch" wrote in message <kqa2u4$2on$1@newscl01ah.mathworks.com>...
> 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
> ?

Subject: surface area of pdedemo3

From: Bill Greene

Date: 25 Jun, 2013 16:43:32

Message: 4 of 6

"Steven Finch" wrote in message <kqcd81$r6k$1@newscl01ah.mathworks.com>...
> Here is more detail. If I append the existing Matlab PDE demo with the commands:
>
> [ux,uy]=pdegrad(p,t,u);
> pi*mean(sqrt(1+ux.^2+uy.^2))
>
> a coarse estimate 3.8042 of the surface area is obtained. What steps can be taken to refine this numerical result? Explicit code would be helpful to me. Thank you!
>
>
>
> "Steven Finch" wrote in message <kqa2u4$2on$1@newscl01ah.mathworks.com>...
> > 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 surface area is given by the integral of the denominator of the first equation in the referenced web page, over the domain. It can be calculated using these PDE Toolbox functions

[ux,uy]=pdegrad(p,t,u);
tArea = pdetrg(p,t);
surfaceArea = sqrt(1 + ux.^2 + uy.^2)*tArea';
surfaceArea

A more accurate result can be obtained simply by refining the mesh.

Bill

Subject: surface area of pdedemo3

From: Alan_Weiss

Date: 25 Jun, 2013 17:19:48

Message: 5 of 6

On 6/25/2013 11:33 AM, Steven Finch wrote:
> Here is more detail. If I append the existing Matlab PDE demo with
> the commands:
>
> [ux,uy]=pdegrad(p,t,u);
> pi*mean(sqrt(1+ux.^2+uy.^2))
>
> a coarse estimate 3.8042 of the surface area is obtained. What steps
> can be taken to refine this numerical result? Explicit code would be
> helpful to me. Thank you!
>
>
>
> "Steven Finch" wrote in message
> <kqa2u4$2on$1@newscl01ah.mathworks.com>...
>> 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
>>
>> ?

After refining the result as follows, I got an estimate of the area of
3.8251. All I did was apply another round of refinemesh, and I set the
rtol to 1e-4 instead of 1e-3 (I don't know if refining rtolis is
important or not). To calculate the area, I added up the areas of the
triangles on the surface.

I imagine that it is easier and less error-prone to use Bill Greene's
suggestion rather than my special-purpose triangle summation function.

Alan Weiss
MATLAB mathematical toolbox documentation

Alan Weiss
MATLAB mathematical toolbox documentation

Subject: surface area of pdedemo3

From: Steven Finch

Date: 2 Jul, 2013 20:16:12

Message: 6 of 6

Alan_Weiss <aweiss@mathworks.com> wrote in message <kqcjfk$ffg$1@newscl01ah.mathworks.com>...
>
> I imagine that it is easier and less error-prone to use Bill Greene's
> suggestion rather than my special-purpose triangle summation function.

Running the following code in Matlab R2013a:

format long
g='circleg';
b='circleb2';
c='1./sqrt(1+ux.^2+uy.^2)';
a=0;
f=0;
rtol=1e-6;
[p,e,t]=initmesh(g);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
[p,e,t]=refinemesh(g,p,e,t);
u=pdenonlin(b,p,e,t,c,a,f,'tol',rtol);
[ux,uy]=pdegrad(p,t,u);
tArea = pdetrg(p,t);
surfaceArea = sqrt(1 + ux.^2 + uy.^2)*tArea';
surfaceArea

gives 3.82697... as an estimate for the surface area
(all five digits of which agree with Ken Brakke's
"Surface Evolver" software). I am thankful to
Alan Weiss and Bill Greene for their generous help.

Steve Finch

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us