%% Plot Sector Index of Model with Complex Coefficients
% Plot the relative sector indices of a model with complex coefficients and a model with real coefficients on the same plot.

rng(0)
A = [-3.50,-1.25-0.25i;2,0];
B = [1;0];
C = [-0.75-0.5i,0.625-0.125i];
D = 0.5;
Hc = [ss(A,B,C,D);1];
Hr = [rss(5);1];
Q = [1 0.1;0.1 -1];
sectorplot(Hc,Hr,Q)
legend('Complex-coefficient model','Real-coefficient model','Location','southwest')

% In log frequency scale, the plot shows two branches for models with complex coefficients, one for positive frequencies, with a right-pointing arrow, and one for negative frequencies, with a left-pointing arrow. In both branches, the arrows indicate the direction of increasing frequencies. The plots for models with real coefficients always contain a single branch with no arrows.
% Set the plotting frequency scale to linear.

opt = sectorplotoptions;
opt.FreqScale = 'Linear';

% Plot the indices.

sectorplot(Hc,Hr,Q,opt)
legend('Complex-coefficient model','Real-coefficient model','Location','southwest')

% In linear frequency scale, the plots show a single branch with a symmetric frequency range centered at a frequency value of zero. The plot also shows the negative-frequency response of a model with real coefficients when you plot the response along with a model with complex coefficients.
% Copyright 2021 The MathWorks, Inc.