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

20 次查看(过去 30 天)
How to calculate volume of surf plot (3d plot) en matlab?
using variable x and y and function z

采纳的回答

Star Strider
Star Strider 2021-9-17
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 个评论
Star Strider
Star Strider 2021-9-17
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by