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

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

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

setoptions(h,'PhaseUnits','rad','Grid','on');

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

plotoptions = nyquistoptions('cstprefs');

% Change properties of the options set by setting the phase units to radians and enabling the grid.

plotoptions.PhaseUnits = 'rad';
plotoptions.Grid = 'on';
nyquistplot(sys,plotoptions);

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