In this example, we will use the ‘hold on’ command to add 3 plots to a single graph. Next, we will see how to add 3 functions to the same graph. We can also use the same ‘hold on’ command to add more than 2 functions also. In the above 2 examples, we saw how to add 2 functions to a single graph. In this example, we will use the ‘hold on’ command to add 2 different exponential functions in one graph.Īs we can see in the output, we have obtained 2 exponential functions in the same graph as expected by us. This is how our input and output will look like in the Matlab command window.Īs we can see in the output, we have obtained 2 logarithmic functions in the same graph as expected by us. Use the ‘hold off’ command to ensure that the next plot, if any, is added as a new graph.Use the plot method to display the 2 nd function.Initialize the 2 nd function to be plotted.Use the ‘hold on’ command to ensure that the plot of the next function is added to this existing graph.Use the plot method to display the 1 st function.Initialize the 1 st function to be plotted.The steps to be followed for this example are: We will plot 2 different logarithmic functions in one graph for our 1 st example. In this example, we will use the ‘hold on’ command to add 2 plots to a single graph. Let us see how to add a new plot to the existing axes in Matlab using the ‘hold on’ command. Command ‘hold off’ is used to change the hold on state back to off. By doing so, the new plot is added to the existing axes without making any changes to the existing plot.
0 Comments
Leave a Reply. |