%% Customize Initial Conditions Plot using Plot Handle
% For this example, use the plot handle to change the time units to minutes and turn on the grid.
% Generate a random state-space model with 5 states and create the initial conditon response plot with plot handle h.

rng("default")
sys = rss(5);
x0 = [1,2,3,4,5];
h = initialplot(sys,x0);

%
% Change the time units to minutes and turn on the grid. To do so, edit properties of the plot handle, h using setoptions.

setoptions(h,'TimeUnits','minutes','Grid','on');

% The plot automatically updates when you call setoptions.
%
% Alternatively, you can also use the timeoptions command to specify the required plot options. First, create an options set based on the toolbox preferences.

plotoptions = timeoptions('cstprefs');

% Change properties of the options set by setting the time units to minutes and enabling the grid.

plotoptions.TimeUnits = 'minutes';
plotoptions.Grid = 'on';
h = initialplot(sys,x0,plotoptions);

% You can use the same option set to create multiple initial condition plots with the same customization. Depending on your own toolbox preferences, the plot you obtain might look different from this plot. Only the properties that you set explicitly, in this example TimeUnits and Grid, override the toolbox preferences.
% Copyright 2021 The MathWorks, Inc.