How to revolve a function f(x) around the x-axis in MATlab or Mathematica

In summary, to revolve a function f(x) around the x-axis in MATlab or Mathematica, one can use the Graphics`SurfaceOfRevolution` package in Mathematica or the 'mesh' command in MATLAB. This involves building a line in one plane and rotating it using a 3x3 rotation matrix to create a 3D object. The volume of this object can be calculated using a definite integral.
  • #1
VinnyCee
489
0
How does one revolve a function f(x) around the x-axis in MATlab or Mathematica?

How would one go about making a visual representation of a function revolved around the x-axis to make a "solid of revolution" in a program like MATlab or Mathematica? For example, a function y = sin(x) can be rotated around the x-axis from x = -3.14 to 3.14, creating a 3D object that has a volume given by the definite integral of pi*sin(x)^2 dx from -3.14 to 3.14. Please help, been trying this for days!
 
Last edited:
Physics news on Phys.org
  • #2
For Mathematica: have you looked at the Graphics`SurfaceOfRevolution` package?
 
  • #3
You need to build a line in one plane which you're going to revolve, and then run a 'for' loop adding new points as you rotate the original line about the axis using a 3x3 rotation matrix.

Then look up the 'mesh' command for syntax getting the points placed in MATLAB.

Is that enough to get you started?
 

1. How do I revolve a function around the x-axis in MATlab or Mathematica?

To revolve a function around the x-axis in MATlab or Mathematica, you can use the built-in "revolution" function. This function takes in the function you want to revolve, the axis of revolution (in this case, the x-axis), and the angle of rotation. For example, if you want to revolve the function f(x) = x^2 around the x-axis, you would use the command "revolution(f, x, 360)". This will create a 3D surface plot of the revolved function.

2. Can I revolve multiple functions at once in MATlab or Mathematica?

Yes, you can revolve multiple functions at once in MATlab or Mathematica by using the "hold on" command. This will allow you to plot multiple functions on the same graph and then use the "revolution" function to revolve all of them around the same axis. For example, if you have two functions f(x) and g(x), you can use the commands "plot(f)" and "hold on" followed by "plot(g)" to plot both functions on the same graph. Then, you can use the "revolution" function to revolve both functions around the x-axis.

3. What if I want to revolve a function around a different axis?

The "revolution" function in MATlab or Mathematica allows you to specify the axis of revolution as a variable, so you can choose any axis you want. For example, if you want to revolve a function f(x) around the y-axis, you would use the command "revolution(f, y, 360)". You can also use the "hold on" command to revolve multiple functions around different axes at once.

4. Can I change the angle of rotation when revolving a function?

Yes, you can change the angle of rotation when revolving a function in MATlab or Mathematica. The "revolution" function takes in the angle of rotation as a parameter, so you can specify any angle you want. For example, if you only want to rotate the function 180 degrees instead of a full revolution, you would use the command "revolution(f, x, 180)".

5. Is there a way to animate the revolution of a function in MATlab or Mathematica?

Yes, you can animate the revolution of a function in MATlab or Mathematica by using the "Manipulate" function. This function allows you to create a slider that controls the angle of rotation, so you can see the function being revolved at different angles. You can also use the "Animate" function to create a video of the revolving function. Both of these options require writing some code, but there are many tutorials and resources available online to help you get started.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Differential Equations
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
794
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Back
Top