Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: volume calculation from surface difference
Date: Fri, 13 Apr 2012 18:41:25 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <jm9s0l$opm$1@newscl01ah.mathworks.com>
References: <jm9nve$6fn$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1334342485 25398 172.30.248.47 (13 Apr 2012 18:41:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 13 Apr 2012 18:41:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:764349

"nman2084" wrote in message <jm9nve$6fn$1@newscl01ah.mathworks.com>...
> .......
> V=dx*dy*sum(dZ);
- - - - - - - - -
  You are apparently assuming that the regions in the x-y plane to be covered by the two surfaces are the same right rectangular area aligned with the two axes.  Otherwise the computation would be way off and would instead require delaunay triangulation or the like.

  Even so, there is a small error in your formula.  You have extended the x-y rectangle all around its edge by 1/2*dx and 1/2*dy in the line "V=dx*dy*sum(dZ);".  Look up the "trapezoidal rule" as exemplified by 'trapz'.

Roger Stafford