what is the right 3D plotting function for my code?

1 回表示 (過去 30 日間)
Romik
Romik 2013 年 4 月 22 日
回答済み: SAI SRUJAN 2023 年 10 月 6 日
Hi all, I have a simple question about 3D plotting.
Consider this simple loop, which provides y and O for any x. and I am able to plot y vs O for given x.
for Omega=0:.01:5
y(i)=(x*Omega^2);
O(i)=Omega;
i=i+1;
end
now consider I want to change the value of x, for x=0:.1:3 and plot the group of y's and O's in one plot.(y~O~x) which one of the 3D plot functions are right for this purpose and what will be the code?
I would appreciate you time and help,
Romik

回答 (1 件)

SAI SRUJAN
SAI SRUJAN 2023 年 10 月 6 日
Hi Romik,
I can understand that you uncertain about the appropriate choice of a 3D plotting function to address your requirements.
The selection of a specific 3D plotting function is contingent upon the unique requirements and objectives of the use case at hand..In MATLAB, there are several functions available to plot in 3D. Here are some commonly used functions for 3D plotting:
  • plot3: This function is used to create 3D line plots. It takes three vectors representing the x, y, and z coordinates of the points and connects them with lines.
  • scatter3: This function is used to create 3D scatter plots. It takes three vectors representing the x, y, and z coordinates of the points and plots them as individual markers.
  • surf: This function is used to create 3D surface plots. It takes a matrix of z-values and generates a surface plot based on the x and y coordinates.
  • mesh: This function is similar to surf and creates a wireframe mesh plot. It takes a matrix of z-values and generates a mesh plot based on the x and y coordinates.
  • contour3: This function creates 3D contour plots. It takes a matrix of z-values and generates contour lines at specified levels based on the x and y coordinates.
For further insights, I have provided links to relevant documentation.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by