I have some data triplets of a surface. For example, I have three (x,y,z) points: (0,0,0.5), (1,0,0.75) and (0 1 1). Could anyone give me some suggestion about how to compute the volume under this surface using MATLAB? Thanks in advance.
0
votes
3 points does not a surface make. How is the surface defined in terms of those three points?
- nneonneo
Also what do you mean by under? Do you mean the volume from the XY-plane up to your Z values?
- Dan
the surface I am dealing with is a bounded surface with x-y plane, y-z plane, z-x plane and the non-uniform plane produced by the triplets. The volume may be from the XY-plane up to Z values.
- Samiul Hayder Choudhury
Assuming you know the formula it should be fairly trivial. If you don't it seems more like a math question, than a programming question.
- Dennis Jaheruddin
1 Answers
1
votes
You will need to take the double integral of your function z: R2 --> R.
Note however, that you are dealing with discrete values, so the integral can only be approximated. Specifically, you have samples of some continuous function z: R2 --> R, at specific (x,y) values which are the points you were given.
The simplest approximation would be to use a Zero-Order-Hold (ZOH), which boils down to assuming your surface is made up of boxes of height 'z', width 'dx' and length 'dy' ('dx' and 'dy' are the resolution at which x and y are specified, and are assumed constant). Then you have: V = dx*dy*Sum_i {z_i}
Other approaches would use more sophisticated method of interpolation. Checkout Matlab's interp2.
Matlab naive volume via ZOH:
dx = 0.1; % x-resolution
dy = 0.1; % y-resolution
x = 0:dx:1;
y = 0:dy:1;
[xs, ys] = meshgrid(x,y); % let there by 2D!
z = abs(sin(pi*(xs-ys))); % the surface (computed over the meshgrid)...
surf(x,y,z); % ...and what a nice surface it is!
V = dx*dy*sum(z(:)); % take the volume