Info

This question is closed. Reopen it to edit or answer.

Am I wrong? need help with a question

1 view (last 30 days)
slowlearner
slowlearner on 17 Aug 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
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.

Answers (1)

Antonio Ciociola
Antonio Ciociola on 17 Aug 2020
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 Comments
Antonio Ciociola
Antonio Ciociola on 17 Aug 2020
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.
slowlearner
slowlearner on 18 Aug 2020
Ok well apparently we are both wrong then.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!