# Drawing 3D Surfaces Of Mathematical Equations In MatLab® Easily

You can draw 3D graphs in Matlab® with conventional methods also. But here, we explain how to directly draw the 3D graph of an equation very easily with the ‘ezmesh()’ command in Matlab®. Take a look at the example below that is executed in the Matlab® command window.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

On this post

## How To Use ‘ezmesh()’ Command In MatLab®?

``ezmesh('x^3+y^3-2*x',[-100,100],50)``

If you execute this one line of code in Matlab®, you will obtain the 3D curve as you see below. Let’s explain how that ‘ezmesh()’ command works.

Three elements are defined inside the ‘ezmesh()’ command. The first one is the equation that we want to obtain its 3D surface. You can write this with a random letter such as ‘x’ which is not needed to be defined in Matlab® as a variable. We think that it is the most easier side of this command over conventional methods to draw 3D graphs in MatLab®.

The second element inside the ‘ezmesh()’ command is the boundaries of the 3D surface in X and Y directions. In here, both boundaries are -100 to 100.

The third element is the definition of the number of grids that will be plotted. In this example, the number is 50.

## Conclusion

As you see above, drawing 3D surfaces with the ‘ezmesh()’ command in Matlab® is very simple.

Do not forget to leave your comments and questions below about the use of the ‘ezmesh()’ command in Matlab® below.

If you want further coding examples about the ‘ezmesh()’ command in Matlab®, inform us in the comments.