MATLAB Answers

Volume of a solid of revolution for a cross section by points

7 ビュー (過去 30 日間)
rodrigo novaes
rodrigo novaes 2021 年 6 月 9 日
回答済み: darova 2021 年 6 月 9 日
I need to find the volume of a solid of revolution. For the cross section, I don't have the formula (for example, y = Ax), I just have some points (for example, 2 vectors with the same size). Based on what I have, I can create a a graph in 2D. After that I should "rotate" this figure and get a solid of revolution, which I need to get its volume.
a = [1 2 3 4 5 6 7 8 9 10]
b = [1 1,5 2 2,5 3 3,5 4 4,5 5]
After getting these 9 points, I can create this graph:
After creating the graph, I can rotate it like the image below (in blue, the line obtained by the graph; in red, the axes; in black, the rotation circle)
So, I get an 3D form and want to get its volume. How can I do it? Is there an precise way for it?
OBS: I thought about splitting it in multiple cilinders, but then it is not that precise when I have just a few points and gets way harder when the image is more complicated as the image below (because then I need to calculate some volumes to remove from a larger volume):
Since now, thanks for your time.

回答 (1 件)

darova 2021 年 6 月 9 日
Looks like simple ellipsoid. Try alphaShape
n1 = 50; % circle points
n2 = 10; % number of circles
[x,y] = pol2cart(linspace(0,2*pi,n1),9); % data for a circle
h = zeros(1,n2); % objects for each circle
ax = axes;
h(1) = plot(x,y); % plot circle
for i = 2:n2
h(i) = copyobj(h(i-1),ax); % copy previous object
rotate(h(i),[1 0.5 0],15,[0 0 0]); % rotate object about [1 0.5 0] vector 15 degree
set(h(1),'color','red','linewidth',3) % highlight original circle
hold on
quiver(0,0,10,5,'linewidth',3) % draw vector of rotation
hold off
% extract each circle data
X = cell2mat(get(h(2:end),'xdata'));
Y = cell2mat(get(h(2:end),'ydata'));
Z = cell2mat(get(h(2:end),'zdata'));
shp = alphaShape(X(:),Y(:),Z(:),inf); % inf - generate convex hull
A = volume(shp)
A = 2.8433e+03

Community Treasure Hunt

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

Start Hunting!

Translated by