![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/346917/image.png)
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Am I wrong? need help with a question
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/346890/image.png)
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 Kommentare
Antworten (1)
Antonio Ciociola
am 17 Aug. 2020
Your question might contain some error, I believe..
The correct formula should be:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/346917/image.png)
And the Volume can be calculated in this way:
volumeis = cumsum(area*deex);
What do you think?
2 Kommentare
Antonio Ciociola
am 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.
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!