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!