| MATLAB® | ![]() |
| On this page… |
|---|
This example shows how to use the Figure Palette to select variables to plot. Suppose you have three variables in your workspace (x, y, z) created by the following statements:
[x,y] = meshgrid([-2:.2:2]); z = x.*exp(-x.^2-y.^2);
You decide to visualize this data as a surface/contour plot (as produced by the surfc function).
The first step is to display a figure with the Figure Palette tool attached. You can do this with the figurepalette command.
figurepalette
Expand the Variables panel and shift-click (for multiple selection) on the three variables you want to pass the plotting function. Since surfc is not in the list, select More Plots.

From the Plot Catalog tool, select the 3D Surfaces in the Categories column and surfc as the Plot Type, as shown in the following picture. To create the plot, click the Plot button.

The following graph results.

You can enter MATLAB® expressions in the Plot Catalog tool, as well as variables. For example, suppose you have created the following variables in the workspace.
t = 0:.01:20; alpha =.055;
and you want to plot t versus this expression:
exp(-alpha*t).*sin(.5*t)
The first step is to display a figure with the Figure Palette tool attached. You can do this with the figurepalette command.
figurepalette
First select the variable t and right-click to display the context menu. Select More Plots.

When the Plot Catalog tool is displayed, add the expression to the Plotted Variables text field. Note that you can reference the variable alpha because you created it in the base workspace. See MATLAB Workspace for information about variables in the MATLAB workspace.

Click the Plot button to create the graph. Note that the previous step is the equivalent of issuing the following command:
plot(t,exp(-alpha*t).*sin(.5*t))
![]() | Example — Working with Plotting Tools | Example — Specifying a Data Source | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |