How do I calculate the volume between two 3D-surfaces?
Afficher commentaires plus anciens
Dear users,
I am having trouble with calculating the volume between two 3D-surfaces in Matlab.
I have two surfaces, which both consists of 5 cross-sections which are linearly interpolated to retrieve the surface. The second surface is an adaptation to the first, in which in this case only the 'bottom' two values of the three middle cross-sections are raised by 0.5. I would like to calculate the volume between the two surfaces, to estimate the volume I need to get from one surface to another. How do I get this volume? I am preferably looking for a solution which is also able to produce the volume if points to the side of the currently adjusted points are adjusted (i.e. if for example the bottom 3 points on either side of x=0 are raised).
I have made the lower surface transparent in the plot below, such that you can see the volume that is in between.
I tried using the trapz-function, but that does not let me use a matrix as an input for X.
Can anyone help me out how to properly calculate this? I imagine it must be fairly simple, but it has got my mind twisted at this point.
x = load('x.mat');
x = x.x;
y = load('y.mat');
y = y.y;
z = load('z.mat');
z = z.z;
z_upd = load('z_upd.mat');
z_upd = z_upd.z_upd;
% Note: all values are symmetrical around x = 0
figure
hold on
surf(x,y,z)
alpha 0.5
surf(x,y,z_upd)
hold off
xlabel('x')
ylabel('y')
zlabel('z')
view(-60,0)
2 commentaires
Torsten
le 22 Juin 2022
Given a point P = (x,y,z), can you determine whether P belongs to the volume or not ?
Jeffrey Clark
le 24 Juin 2022
Modifié(e) : Jeffrey Clark
le 24 Juin 2022
@Birgit, since you seem to only refer to surfaces but then ask for volumn between them, are you just asking for the volumn contained by the two surfaces that are slightly offset but joined for the rest of the much larger surface? Like the more luminous red here?

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
