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

Click For Summary
SUMMARY

The discussion focuses on 3D plotting in MATLAB, specifically using the meshgrid and surf functions to visualize the relationship between variables. The user, Romik, seeks guidance on how to plot multiple values of y against O for varying x values. The recommended solution involves creating a grid of x and Omega values, calculating Y using the formula Y = X .* Omega.^2, and then utilizing surf(X, Y, Omega) for the 3D plot.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of 3D plotting concepts
  • Knowledge of matrix operations in MATLAB
  • Basic understanding of the meshgrid and surf functions
NEXT STEPS
  • Explore the meshgrid function in MATLAB for creating coordinate grids
  • Learn about the surf function for 3D surface plotting in MATLAB
  • Investigate advanced 3D plotting techniques in MATLAB, such as mesh and contour3
  • Review MATLAB documentation on visualizing multi-dimensional data
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and engineers looking to enhance their skills in 3D data visualization and plotting techniques.

Romik
Messages
13
Reaction score
0
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
 
Physics news on Phys.org
You'll probably want to use meshgrid and surf. Something like:
Code:
x = linspace[/color](0, 3, 100);
omega = linspace[/color](0, 5, 100);
[X Omega] = meshgrid[/color](x, omega);
Y = X .*[/color] Omega .^[/color]2;
surf(X, Y, Omega); [i]% Or whatever order you want to plot...[/i][/color]
 
Last edited:

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K