How to Use Surf() for 3D Plotting in MATLAB?

In summary, to create a 3D plot in MATLAB, you can use the "plot3" or "surf" function. You can also customize the appearance of your plot with labels, titles, and viewing angles. To add a color gradient, use the "colormap" and "shading" functions. Multiple data sets can be plotted by using the "hold on" function and labeling them with the "legend" function. To save your plot, use the "saveas" or "print" function. The "rotate" and "view" functions allow you to change the viewing angle of your plot.
  • #1
Estabraq
1
0
Hello,

i have a function that i need to plot in 3d, it specifically describes the change in the power of a router considering many readings in different places..

so i have the power in dBm against a square space of a building..

if anyone can help me use the surf(), how should i arrange the matrices??
 
Physics news on Phys.org
  • #2
Welcome to PF!

What have you tried so far? What does your matrix (or matrices) look like? Please provide some of these details so that we can help you in ways other than saying "Check the documentation".

Ben
 

FAQ: How to Use Surf() for 3D Plotting in MATLAB?

1. How do I create a 3D plot in MATLAB?

To create a 3D plot in MATLAB, you can use the "plot3" function and provide the x, y, and z coordinates of your data points. Alternatively, you can use the "surf" function to create a surface plot. Both of these functions allow you to customize the appearance of your 3D plot, such as adding labels, titles, and adjusting the viewing angle.

2. How do I add a color gradient to my 3D plot in MATLAB?

To add a color gradient to your 3D plot in MATLAB, you can use the "colormap" function. This allows you to map a range of colors to your data points based on their values. You can also use the "shading" function to adjust the smoothness of the color transitions on your plot.

3. Can I plot multiple data sets in one 3D plot in MATLAB?

Yes, you can plot multiple data sets in one 3D plot in MATLAB by using the "hold on" function. This allows you to add additional data sets to your plot without overwriting the previous one. You can also use the "legend" function to label each data set in your plot.

4. How do I save my 3D plot in MATLAB as an image or file?

To save your 3D plot in MATLAB as an image or file, you can use the "saveas" function. This allows you to specify the file format and name of your saved plot. You can also use the "print" function to customize the resolution and size of your saved plot.

5. Is there a way to rotate and view my 3D plot from different angles in MATLAB?

Yes, you can use the "rotate" function in MATLAB to change the viewing angle of your 3D plot. This allows you to rotate and view your plot from different perspectives. You can also use the "view" function to specify the azimuth and elevation of your plot's viewing angle.

Similar threads

Replies
2
Views
3K
Replies
4
Views
1K
Replies
2
Views
3K
Replies
2
Views
1K
Replies
1
Views
1K
Replies
1
Views
5K
Replies
11
Views
2K
Replies
3
Views
2K
Back
Top