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$>
References: <jm9nve$6fn$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1334342485 25398 (13 Apr 2012 18:41:25 GMT)
NNTP-Posting-Date: Fri, 13 Apr 2012 18:41:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:764349

"nman2084" wrote in message <jm9nve$6fn$>...
> .......
> 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