how to find volume using integral
조회 수: 21 (최근 30일)
이전 댓글 표시
how to calculate volume using integral function from the given matrix of a,b,c coordinates
댓글 수: 0
답변 (1개)
Mike Hosea
2015년 2월 14일
편집: Mike Hosea
2015년 2월 14일
You can't do that with INTEGRAL. The integral functions are for integrating functions, not data. A set of coordinates in 3-D space does not have a volume, since points have no volume. I would guess that you mean, for example, the volume of a polyhedron defined by those vertices or some such. That's just a guess. If that is what you mean, you might want to ask "How do I find the volume of a polyhedron in MATLAB given a matrix of vertex points?"
Now to answer the question of the title of how to find volume using INTEGRAL, here is an example that computes the volume of a sphere. Of course it's fairly dumb to compute the area of a sphere this way, but the point of the example is to illustrate the use of functions to define the region of interest. It should be clear how to modify it for other regions that can be described as being bounded by a <= x <= b, c(x) <= y <= d(x), e(x,y) <= z <= f(x,y).
a = -1;
b = 1;
c = @(x)-sqrt(1 - x.^2);
d = @(x)sqrt(1 - x.^2);
e = @(x,y)-sqrt(1 - x.^2 - y.^2);
f = @(x,y)sqrt(1 - x.^2 - y.^2);
volume = integral3(@(x,y,z)ones(size(x)),a,b,c,d,e,f)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Volume Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!