Info
此问题已关闭。 请重新打开它进行编辑或回答。
Am I wrong? need help with a question
1 次查看(过去 30 天)
显示 更早的评论
I've starring my self blind at this one the question is as follows:
Write a program which calculates the volume of the body that acumulates by the curve when y =x^2, 1<x<2, rotates around the x-axis. that is to say write a program which calculates the volume according to the integral below
hint: the command integral can be used to calculate the integral
Now my first thoughts was to do some napkin maths becouse the x^4 didn't seem like the correct integration of the y equation. I couldn't see how the result would be x^4 with pi included either and you can't calculate the volume of a rotating body without pi, i mean you could but its not cool. I dicided to write what i was thinking would be a correct calculation of the equation in the following way:
%% c i'm confused f(x)=x^2 ~F(x)=x^4 sens F'(x)=4x^3
%and isn't volume missing pi becouse of the rotation?
clear x x1 x2 y f G X Y;
% figure(3);
deex = 0.001; %the increment of which you move along the x axis which is 1/10th times smaller than normal linspace
x = 1:deex:2; %length of the "sample"
radius = x.^2; %radius of the "disc" at each x
area = pi*radius.^2; %area of each disk
volumeis = cumtrapz(area*deex); %comulative trapezoidal rule applied here showing a comulative volume for each calculated area at x
now i know that cumtrapz might not be nessecary here but i've never used it and i thought it would be cool. however supposedly it's wrong and i fail to see where any feedback would be nice.
0 个评论
回答(1 个)
Antonio Ciociola
2020-8-17
Your question might contain some error, I believe..
The correct formula should be:
And the Volume can be calculated in this way:
volumeis = cumsum(area*deex);
What do you think?
2 个评论
Antonio Ciociola
2020-8-17
Of course you can use also "cumtrapz".
You can use both "cumsum" and "cumtrapz" but keep in mind that these functions are different approximation of the integral that you're trying to evaluate.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!