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

Click For Summary
SUMMARY

To revolve a function f(x) around the x-axis in MATLAB or Mathematica, one can utilize the 'mesh' command in MATLAB for creating a visual representation of the solid of revolution. In Mathematica, the Graphics`SurfaceOfRevolution` package is essential for this task. For example, revolving the function y = sin(x) from x = -3.14 to 3.14 involves calculating the volume using the definite integral of π*sin(x)^2 dx. A 3x3 rotation matrix is used in Mathematica to generate the points for the revolution.

PREREQUISITES
  • Familiarity with MATLAB syntax and commands
  • Understanding of Mathematica's Graphics`SurfaceOfRevolution package
  • Knowledge of definite integrals and volume calculations
  • Basic understanding of 3D transformations and rotation matrices
NEXT STEPS
  • Learn how to use the 'mesh' command in MATLAB for 3D plotting
  • Explore the Graphics`SurfaceOfRevolution package in Mathematica
  • Study the application of 3x3 rotation matrices in 3D graphics
  • Investigate the calculation of volumes of solids of revolution using integrals
USEFUL FOR

Mathematics students, educators, and software developers interested in 3D modeling and visualization techniques in MATLAB and Mathematica.

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
3K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
3
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K