Sometimes, it can be very useful to show all graphs in one graph to analyze related data from this one graph. You can combine different curves in one graph in Matlab®. In this article drawing multiple curves on one graph figure in Matlab® is explained with a very basic example below.
YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!
How To Combine Multiple Curves In One Graph In Matlab®?
It is very easy to combine different curves in Matlab®. Create the required variables that must be in the same length in Matlab®. After that create your first graph by coding it with the plot() command as above. Also add other graph design codes such as ‘xlabel(), ylabel()’ commands beneath this. Your first graph will be created on one figure as shown by the green arrow above in Matlab®.
Add another graph to this graph, type ‘hold on’ as shown by the red box above. After this command, created the second graph with plot() command as shown by the red arrow, also you can add other graph properties as the previous example in Matlab®.
If you want to add another third graph on the same figure above, do the same process; type holds on and writes the commands to create the third curve in Matlab®.
If you want to draw the only last curve on the graph, not other ones, type ‘hold off’ at the end of the code.
This is the general logic of drawing multiple graphs in one figure in Matlab®. We expressed it with a very basic example above but if you want much more complex examples about multiple curves in one figure in Matlab®, we can create another article about it in Mechanicalland.
Leave your comments and questions about drawing multiple curves on one figure 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.