This example shows how to create a 2-D line plot interactively using the Plots tab in the MATLAB® toolstrip. The Plots tab shows a gallery of supported plot types based on the variables you select from your workspace.
In the Command Window, define x as a vector of 50 linearly spaced values between 1 and 10. Define y as the sine function.
x = linspace(1,10,50); y = sin(x);
In the Workspace panel in the MATLAB desktop, select the variables to plot. Use Ctrl + click to select multiple variables.
Select the 2-D line plot from the gallery on the Plots tab. For additional plot types, click the arrow at the end of the gallery.
MATLAB creates the plot and displays the plotting commands at the command line.