Two-dimensional graphs are frequently used in data analysis. Also, you could have to draw two-dimensional graphs in Matlab® with various variables. In this article, we will explain how to draw two-dimensional graphs in Matlab®.
How To Draw Two Dimensional Graphs In Matlab®?
To draw 2D graphs, you need to have 2 variables needed to be created in Matlab®. For example, we created a complex number in Matlab® to show you how to create two-dimensional graphs.
The command to create two-dimensional graphs in Matlab® is ‘plot()’ as shown in the magenta box above in Matlab®. You need to type the variables inside the plot(a, b) command then also you can add a pointer like above which is added as ‘o’. This pointer shows the location of the complex number ‘a’ as shown by arrow above.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
With the ‘xlabel()’ command, you can define the name of the x label of the two-dimensional graph that you create in Matlab®. You need to type the name of the x label inside the xlabel() code as ‘name of the label x’.
Also, you can do the same thing for the y label of the drawn graph with the ‘ylabel()’ command as shown above in Matlab®.
With the ‘title()’ command, you can add an expressive title to your two-dimensional graph in Matlab®. The use of this code is the same with xlabel() and ylabel() commands.
You can define the boundaries of axes with the axis() command as above. For example, we type the boundary values of x and y axes inside the axis() command as [x x y y] which is the start and end value of the x-axis and start and end value of the y-axis respectively.
Also, we wanted to arrange our graph in square shape in Matlab®, then we simply typed ‘axis square’ as shown above.
Also you can do;
- axis equal: Automatically arranges the axes equally.
- axis normal: Arranges axes as rectangular shape of the graph.
The most basic two-dimensional graph creation in Matlab® can be expressed like this. Also, we can publish much more complex examples about two-dimensional axis creation in Matlab® if you wish.
Leave your comments and questions about two-dimensional graph drawing in Matlab®!
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.