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

조회 수: 20 (최근 30일)
abdelmadjid benrabah
abdelmadjid benrabah 2021년 9월 17일
댓글: Star Strider 2021년 9월 17일
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
abdelmadjid benrabah
abdelmadjid benrabah 2021년 9월 17일
okay, thnx again
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