How to Make 3D Plots Using MATLAB

Open the command window., If the command window isn't present, select home in the upper left corner., In the command window, define both of your x and y vectors., Define a relationship between x and y., When using mesh, input meshgrid to the command...

14 Steps 2 min read Advanced

Step-by-Step Guide

  1. Step 1: Open the command window.

    In the default layout this should appear automatically as the biggest window displayed.
  2. Step 2: If the command window isn't present

    Afterwards, select layout and then "Default". , This is typically done in the form of x=and y=Remember to use the dot operator when multiplying or dividing vectors and matrices.

    Otherwise errors will occur. , In order to accomplish this, two commands must be used.

    The first is the mesh function.

    By using this, the result will be a wireframe mesh graph.

    The other is the surf function.

    When using surf, the result will be a 3-D surface plot. , The command will be formatted as follows: =meshgrid(x,y).

    In the workspace window you will see that the variables xx and yy have been defined. , Use the relationship you know exists between x and y.

    This is likely to be a function or formula. e.g., zz=xx.^2-yy.^2 , From the z components in the matrix "zz"

    the surf command will create a 3-D shaded surface.

    This is the point in which you will relate xx, yy, and zz together.

    The actual command line will be in the format of surf(xx,yy,zz) . ,, There is a toolbar at the top of the window where the new plot has appeared.

    This toolbar contains many options and features that can be used to manipulate your 3-D plot.

    Some of these options include:
    Inserting a label for the x, y, or z axis Inserting a legend to help readers Rotating the plot in it's 3-D space Inserting a light source to show the effects of shadows A list of complex surface properties can be found at http://www.mathworks.com/help/matlab/examples/changing-surface-properties.html , This is done by using the command line shading interp.
  3. Step 3: select home in the upper left corner.

  4. Step 4: In the command window

  5. Step 5: define both of your x and y vectors.

  6. Step 6: Define a relationship between x and y.

  7. Step 7: When using mesh

  8. Step 8: input meshgrid to the command window.

  9. Step 9: Define zz in terms of xx and yy because of its reliance on those sets of data.

  10. Step 10: Plot the surface using the surf command.

  11. Step 11: Watch for your new window to appear showing your 3-D plot.

  12. Step 12: Customize as you'd like.

  13. Step 13: Smooth the color map across the entire surface of the graph

  14. Step 14: if you'd like.

Detailed Guide

In the default layout this should appear automatically as the biggest window displayed.

Afterwards, select layout and then "Default". , This is typically done in the form of x=and y=Remember to use the dot operator when multiplying or dividing vectors and matrices.

Otherwise errors will occur. , In order to accomplish this, two commands must be used.

The first is the mesh function.

By using this, the result will be a wireframe mesh graph.

The other is the surf function.

When using surf, the result will be a 3-D surface plot. , The command will be formatted as follows: =meshgrid(x,y).

In the workspace window you will see that the variables xx and yy have been defined. , Use the relationship you know exists between x and y.

This is likely to be a function or formula. e.g., zz=xx.^2-yy.^2 , From the z components in the matrix "zz"

the surf command will create a 3-D shaded surface.

This is the point in which you will relate xx, yy, and zz together.

The actual command line will be in the format of surf(xx,yy,zz) . ,, There is a toolbar at the top of the window where the new plot has appeared.

This toolbar contains many options and features that can be used to manipulate your 3-D plot.

Some of these options include:
Inserting a label for the x, y, or z axis Inserting a legend to help readers Rotating the plot in it's 3-D space Inserting a light source to show the effects of shadows A list of complex surface properties can be found at http://www.mathworks.com/help/matlab/examples/changing-surface-properties.html , This is done by using the command line shading interp.

About the Author

N

Nicole Rodriguez

Nicole Rodriguez has dedicated 1 years to mastering humanresources. As a content creator, Nicole focuses on providing actionable tips and step-by-step guides.

28 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: