How to find volume of a curve [f(x)] which is rotated along y-axis?
7 views (last 30 days)
Show older comments
We have a input function y = f(x) and we have to find the volume along x-axis and y-axis. (solid of revolution) The minimum and maximum values of x are given
I am getting the volume along x-axis but I am getting an error while finding the volume along the y-axis.
The values of f(x) and domain is : -
- x^(1/2), 0<=x<=4
- 3*cos(0.4*x+pi), -5<=x<=5
- sin(x)+3, -5<=x<=5
- x^3, 0<=x<=3
Here is my code
%Volume along x-axis
clc
clear all
syms x y
%fx = input('Enter the function : ')
xmin = input('Enter minimum value of x : ')
xmax = input('Enter maximum value of x : ')
intfx = int((fx)^2,xmin,xmax)
vx = pi*(intfx)
vx = double(vx)
sprintf('The volume along x-axis is %d',vx)
%Volume along y-axis
y_fx_equation_wrt_x = y == fx
x_fy_equation_wrt_y = solve(y_fx_equation_wrt_x, x)
fy = x_fy_equation_wrt_y
ymin = subs(fx,x,xmin)
ymax = subs(fx,x,xmax)
intfy = abs(int(fy^2,ymin,ymax))
vy = pi*(intfy)
vyy = double(vy)
sprintf('The volume along y-axis is %d',vyy)
In output 1 I get an error but on output 2 I don't.
What am I doing wrong?
Output 1
y = 3*cos(0.4*x+pi)
3*cos(0.4*x+pi)
fx =
-3*cos((2*x)/5)
Enter minimum value of x :
-5
xmin =
-5
Enter maximum value of x :
5
xmax =
5
intfx =
(45*sin(4))/4 + 45
vx =
pi*((45*sin(4))/4 + 45)
vx =
114.6241
ans =
'The volume along x-axis is 1.146241e+02'
y_fx_equation_wrt_x =
y == -3*cos((2*x)/5)
x_fy_equation_wrt_y =
(5*pi)/2 - (5*acos(y/3))/2
(5*pi)/2 + (5*acos(y/3))/2
fy =
(5*pi)/2 - (5*acos(y/3))/2
(5*pi)/2 + (5*acos(y/3))/2
ymin =
-3*cos(2)
ymax =
-3*cos(2)
Error using ^ (line 442)
Matrix must be square.
Error in Week6classwork1_2 (line 35)
intfy = abs(int(fy^2,ymin,ymax))
Output 2
y = x^(0.5)
Enter the function :
x^(0.5)
fx =
x^(1/2)
Enter minimum value of x :
0
xmin =
0
Enter maximum value of x :
4
xmax =
4
intfx =
8
vx =
8*pi
vx =
25.1327
ans =
'The volume along x-axis is 2.513274e+01'
y_fx_equation_wrt_x =
y == x^(1/2)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
x_fy_equation_wrt_y =
y^2
fy =
y^2
ymin =
0
ymax =
2
intfy =
32/5
vy =
(32*pi)/5
vyy =
20.1062
ans =
'The volume along y-axis is 2.010619e+01'
0 Comments
Answers (0)
See Also
Categories
Find more on Volume Visualization 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!