In many situations, it can be desirable to plot and compare several different functions at the same time. There are a few different options available in Matlab to accomplish this task.

 

 

Multiple plots can be displayed in their own separate figure windows by using the command: figure; between each instance the plot function is called. More explicitly, the commands figure(1), figure(2), figure(3), etc. can be used to assign a particular use of the plot function to a particular figure window.

 

Multiple plots can be displayed in a single figure window by using several methods. First, simply adding additional input variables in the plot function will display multiple lines on the same axes. As an example, the command: plot(x, y, t, z) will display the values of the y variable versus the x variable and also display the values of the z variable versus the t variable. Therefore, the x and y variables must have the same dimensions and the t and z variables must have the same dimensions.

 

Second, the commands hold on and hold off can be used together to display multiple plots. One way to think about these commands is that they hold open a single figure window. With these commands, multiple instances of the plot function can be called, and they are all displayed on the same axes.

 

Third, multiple plots can be displayed on multiple axes within the same figure window using the command: subplot. In this case, a single figure window is opened. Then the window is divided into different areas, each with its own two-dimensional axes. A single plot can be displayed on each of the axes. More information on the subplot function can be found here.

 

Next, let’s look at specifically plotting the waveform of an audio signal.

Receive Updates

No spam guarantee.