MATLAB: Plotting help, turning 2D plot into 3D volume of revolution

In summary, one could use 3D plotting software, calculate z-coordinates, or utilize a 3D graphing library to create a 3D representation of the data.
  • #1
sunnygsm
1
0
Hi I have an issue I am trying to solve, so far I haven't managed to get past it.

I have some data for 200 points in theta from 0 to 2PI. The data is spherically symmetric so there is no phi dependence. Basically what I want to do is turn the 2D plot into a 3D by revolving the 2D plot.

My data are velocities which enter in the format. (theta from Z axis)

x = V. cos(theta)
y = V. sin(theta)

V is an array of length 200. And each element in V corresponds to a different value of theta.

Any thoughts on how I might turn this into a 3D plot? If you need clarification please let me know.
 
Physics news on Phys.org
  • #2
One approach you could take is to use some 3D plotting software such as MATLAB or another similar tool. You would need to format the data into a 3D array and then plot it. The array should have three columns, with the first column being theta, the second being x and the third being y. Another approach would be to calculate the z-coordinates of each point given the x and y coordinates. You can then plot the points in a 3D scatter plot to get a 3D representation of the data. Finally, you could also use a 3D graphing library such as D3.js or Three.js to create a 3D line graph of your data. You would again need to format the data into a 3D array with theta, x, and y coordinates before plotting.
 

1. How do I plot a 2D graph in MATLAB?

To plot a 2D graph in MATLAB, you can use the "plot" function. This function takes in two vectors as input, one for the x-values and one for the y-values, and plots the points on a 2D graph. You can also add labels, titles, and customize the appearance of the graph using various options.

2. How can I create a 3D volume of revolution in MATLAB?

To create a 3D volume of revolution in MATLAB, you can use the "surf" function. This function takes in a matrix of data points as input, where the rows represent the x-values, the columns represent the y-values, and the values in the matrix represent the z-values. MATLAB will then generate a 3D surface plot using these data points. You can also customize the appearance of the volume by adjusting the color, lighting, and viewing angle.

3. Can I add multiple plots to a single 3D volume of revolution plot?

Yes, you can add multiple plots to a single 3D volume of revolution plot in MATLAB by using the "hold on" command. This command allows you to plot multiple surfaces or objects onto the same figure. Just make sure to use the "hold off" command when you are finished adding all the plots, so that any subsequent plots will not be added to the same figure.

4. How do I rotate and view my 3D volume of revolution from different angles?

To rotate and view your 3D volume of revolution from different angles in MATLAB, you can use the "view" function. This function takes in three inputs: the azimuth angle, the elevation angle, and the distance from the origin. You can adjust these values to change the viewing angle and perspective of your plot.

5. Is it possible to export my 3D volume of revolution plot as an image or video?

Yes, you can export your 3D volume of revolution plot as an image or video in MATLAB by using the "saveas" or "getframe" functions. The "saveas" function allows you to save your plot as an image file, while the "getframe" function captures a frame of your plot and allows you to create a video by combining multiple frames. You can also use the "print" function to customize the resolution and format of your exported plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
9K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top