www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/CreateAdditionalGraphInNewFigureWindowExample.m

    %% Create Graph in New Figure Window
% This example shows how to create a graph in a new figure window, instead
% of plotting into the current figure. 

% Copyright 2015 The MathWorks, Inc.


%%
% Define |x| and |y|.

x = linspace(0,2*pi,25);
y = sin(x);
%%
% Create a stairstep plot of |y| versus |x|. Open a new figure window using
% the |figure| command. If you do not open a new figure window, then by
% default, MATLAB(R) clears existing graphs and plots into the current
% figure.

figure % new figure window
stairs(x,y)