# Drawing 3D Surfaces Effectively In MatLab

You can draw 3D surfaces by defining their numerical equations in Matlab. This kind of businnes can be done with mesh() command also, but with this command you can not obtain a surface, you can obtain a mesh structure. To obtain surfaces in Matlab, you need to use ‘surf()’ command instead of mesh() command. In here, we will express how to use ‘surf()’ command to create 3D surfaces in Matlab.

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

Use of surf() command in Matlab is very easy like above. As you see, we first created 3D domain with meshgrid() command as shown by red arrow above. To obtain 3D surfaces in 3D space, you need to create 3D domain for this surface. This is done by typing two of vectors inside meshgrid() command.

These two vectors are also created in Matlab for further use as above. We created another function that will be de third dimension which is defined in terms of X and Y vectors. This is an actually polynomial vector.

So we have two of vectors and one polynomial that dependent on these two vectors. We can create out 3D surface by using these three elements in Matlab. You need to type the all these three variables inside surf() command as shown in green box above, then press ‘Enter’ from your keyboard.

As you see above, 3D surface is created in Matlab. You can pan, zoom rotate this graph with your mouse. To rotate this surface, hold your mouse left clicked, then drag it.

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

Also you can add legends, titles, subtitles into your surface or graphs in Matlab. To see how its done, click on the given link.

Do not forget to leave your comments and questions about creating 3D surfaces in Matlab with surf() command below. Your precious feedbacks are very important for us.