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

Click For Summary
To revolve a function f(x) around the x-axis in MATLAB or Mathematica, one can create a visual representation of a solid of revolution. For example, the function y = sin(x) can be rotated from x = -3.14 to 3.14, resulting in a 3D object whose volume is calculated using the definite integral of pi*sin(x)^2 dx over that interval. In Mathematica, the Graphics`SurfaceOfRevolution` package can be utilized, where a line is constructed in one plane and then rotated using a 3x3 rotation matrix within a loop to generate new points. In MATLAB, the 'mesh' command is essential for placing these points correctly to visualize the solid. This approach provides a foundational method for creating solids of revolution in both programming environments.
VinnyCee
Messages
486
Reaction score
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
For Mathematica: have you looked at the Graphics`SurfaceOfRevolution` package?
 
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?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K