MATLAB: Calculate volume below a 3D points

3dintegralMATLABnansurface

I have a set of x,y,z numbers and would like to calculate the volume beneath the surface that passes through them. The data(T) is attached. x=T(:,1), y=T(:,2), z=T(:,3).
Can you please help me.
I use the followig code:
x=T(:,1);
y=T(:,2);
z=T(:,3);
plot3(x,y,z,'.')
interpZ = @(xi,yi) griddata(x,y,z,xi,yi) %set up interpolation
vol = quad2d(interpZ,min(x),max(x),min(y),max(y)) %volume should be close to 1
I get a Nan and " Non-finite result. The integration was unsuccessful. Singularity likely."

Best Answer

Which volume do you want to calculate? Values of surface are below and above also
img.png Untitle1d.png
I tried rough method: values of Z in each node multiply dx*dy and sum
img1.png
But the result is not close to 1 ( )
Related Question