Create Graph Using Plots Tab

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.

  1. 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);
  2. In the Workspace panel in the MATLAB desktop, select the variables to plot. Use Ctrl + click to select multiple variables.

  3. 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.

plot(x,y)

See Also

| |

Related Examples

Was this topic helpful?