%% Customize Sigma Plot using Plot Handle
% For this example, use the plot handle to change the frequency units to Hz and turn on the grid.
% Generate a random state-space model with 5 states and create the sigma plot with plot handle h.

rng("default")
sys = rss(5);
h = sigmaplot(sys);

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

setoptions(h,'FreqUnits','Hz','Grid','on');

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

p = sigmaoptions('cstprefs');

% Change properties of the options set by setting the frequency units to Hz and enable the grid.

p.FreqUnits = 'Hz';
p.Grid = 'on';
sigmaplot(sys,p);

% You can use the same option set to create multiple sigma 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 Grid and FreqUnits, override the toolbox preferences.
% Copyright 2021 The MathWorks, Inc.