# MATLAB: Volume of 3D data points and volume of Convex Hull of those data points

convexhullvolume

I am having 3D data points. I want to calculate volume of these 3D points. Then I want to calculate volume of convex hull of these data points.
I have calculated volume of 3D points by calculating number of voxels and volume of convex hull by using 'convhull' command. But, I think method of calculating volume in convhull is different.
So, I want to know how to calculate volume in these two cases using same method.

#### Best Answer

• So it sounds like you have a binary three dimensional volume that you are essentially summing to get the volume of the points? If this is correct, I would first calculate an isosurface of this using isosurface:
doc isosurface
Then with vertices from the isosurface, calculate the convex volume using convhulln. To calculate the non-convex volume, you can do what you're doing now which will be an overapproximation or you could convert the mesh to convex tetrahedra and sum up their volumes.
This might help with that: