You can draw 3D surfaces by defining their numerical equations in Matlab®. This kind of business can be done with the 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 the ‘surf()’ command instead of the mesh() command. Here, we will express how to use the ‘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 a 3D domain with meshgrid() command as shown by the red arrow above. To obtain 3D surfaces in 3D space, you need to create a 3D domain for this surface. This is done by typing two vectors inside the 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 actual polynomial vector.
So we have two vectors and one polynomial that dependent on these two vectors. We can create the 3D surface by using these three elements in Matlab®. You need to type all these three variables inside the surf() command as shown in the green box above, then press ‘Enter’ from your keyboard.
As you see above, a 3D surface is created in Matlab®. You can pan, zoom rotate this graph with your mouse. To rotate this surface, hold your mouse left click, 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 it’s done, click on the given link.
Do not forget to leave your comments and questions about creating 3D surfaces in Matlab® with the surf() command below. Your precious feedbacks are very important for us.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.