How to calculate volume of surf plot (3d plot) en matlab?

20 vues (au cours des 30 derniers jours)
abdelmadjid benrabah
abdelmadjid benrabah le 17 Sep 2021
Commenté : Star Strider le 17 Sep 2021
How to calculate volume of surf plot (3d plot) en matlab?
using variable x and y and function z

Réponse acceptée

Star Strider
Star Strider le 17 Sep 2021
The surf plot arguments are matrices, so use trapz:
x = 1:10;
y = 1:20;
[X,Y] = meshgrid(x,y);
z = exp(-((X-5)/5.*(Y-10)/10).^2)
z = 20×10
0.5955 0.7471 0.8784 0.9681 1.0000 0.9681 0.8784 0.7471 0.5955 0.4449 0.6639 0.7942 0.9027 0.9747 1.0000 0.9747 0.9027 0.7942 0.6639 0.5273 0.7308 0.8383 0.9246 0.9806 1.0000 0.9806 0.9246 0.8383 0.7308 0.6126 0.7942 0.8784 0.9440 0.9857 1.0000 0.9857 0.9440 0.8784 0.7942 0.6977 0.8521 0.9139 0.9608 0.9900 1.0000 0.9900 0.9608 0.9139 0.8521 0.7788 0.9027 0.9440 0.9747 0.9936 1.0000 0.9936 0.9747 0.9440 0.9027 0.8521 0.9440 0.9681 0.9857 0.9964 1.0000 0.9964 0.9857 0.9681 0.9440 0.9139 0.9747 0.9857 0.9936 0.9984 1.0000 0.9984 0.9936 0.9857 0.9747 0.9608 0.9936 0.9964 0.9984 0.9996 1.0000 0.9996 0.9984 0.9964 0.9936 0.9900 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
zvol = trapz(x,trapz(y,z))
zvol = 158.0451
figure
surf(x, y, z)
grid on
.
  4 commentaires
abdelmadjid benrabah
abdelmadjid benrabah le 17 Sep 2021
okay, thnx again
Star Strider
Star Strider le 17 Sep 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by