Next Post:

Copying Objects In AutoCAD(Illustrated Expression)

Drawing Multiple Curves On One Graph In MatLab(Illustrated Expression)


Sometimes, it can be very useful to show all graphs in one graph to analyse related datas 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.

How To Combine Multiple Curves In One Graph In Matlab?

Use of  ‘hold on’ command 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 plot() command as above. Also add other graph design codes such as xlabel(), ylabel()’ commands beneath this. Your fist graph will be created on one figure as shown by green arrow above in Matlab.

Add an another graph to this graph, type ‘hold on’ as shown by red box above. After this command, created the second graph with plot() command as shown by red arrow, also you can add other graph properties as previous example in Matlab.

If you want to add an another third graph on same figure above, do the same process; type hold on and write the commands to create the third curve in Matlab.

If you want to draw the only last curve on 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 on figure in Matlab, we can create an another article about it in Mechanical Base.

Leave your comments and questions about drawing multiple curves on one figure in Matlab!

  • Site Comments

At least 10 characters required.