Did I do it right?Or I'm miss-interpreting the question?I'm so confused!!
1 view (last 30 days)
Show older comments
Mobasher Hossain
on 15 Mar 2015
Commented: Mobasher Hossain
on 16 Mar 2015
Hi all, I'm trying to Write a program to calculate the volume under x^2 +1 curve when the curve is rotated around the x axis. The Integration of x from 0 to 3 with an increment of 0.1 using the disk method.Then Add to the above program, saving each value of the integral as well as the x coordinates in arrays, and plotting them to show the change in volume (of the revolution) as x goes from 0 to 3.0.We didn't have integration on MATlab class yet so I used the method:
l = 0.1;
for index = 1:30;
x(index) = (index-1)*0.1;
y1(index) = pi*((x(index).^2 +1)^2)*l;
y2(index) = (-pi*((x(index).^2 +1)^2)*l);
end
%PLOT x VERSUS y
plot(x,y1,'m*-',x,y2,'b^--');
However,I'm not confident with my approach.If I just do y1,erasing y2,I get a graph of a simple curve,which doesn't represent any 'change of volume' asked by original question.That's why I used y2 as a function of y1,but the negative one,which goes on the -y coordinate,just to make it analogous with the disk method of integration rotating around x axis.I'm very confused!I'm not sure if that's what 'the change of volume' asks.Or should I think about graphing in three dimension?If so then how do I do that?
0 Comments
Accepted Answer
John D'Errico
on 15 Mar 2015
So, for ANY value of x, if that curve is rotated around the x axis, then what is the radius of the circular cross section?
deltax = 0.1;
x = 0:deltax:3;
radius_x = x.^2 + 1;
The area of that disk is what?
area_x = pi*radius_x.^2;
We can compute a cumulative volume, where that integral is defined by the rectangle rule simply using cumsum.
volume_rect = cumsum(area_x*deltax);
Of course, we could have used a cumulative trapezoidal rule, so cumtrapz.
If you MUST avoid those tools, then a simple loop will suffice, accumulating that integral. I'm not sure what it is you know, and what you are allowed to use, so you need to decide.
3 Comments
John D'Errico
on 15 Mar 2015
The volume "change" as you rotate it? What are you rotating? I think you are getting confused.
The volume computed is that of the surface of rotation. You have implicitly rotated that curve into a surface by computing the area of each circular disk.
If you want to compute the differential volume along the x axis,
diff(volume_rect)
does that. This is the change in volume as we move along the x axis. Note that there is one less element in that vector, since it is a difference.
In fact, this is exactly what was requested:
"show the change in volume (of the revolution) as x goes from 0 to 3.0."
The revolution refers to the surface of revolution. The change in volume merely asks to see how that volume changes as we move along the x axis.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!