%% Nichols Plot of MIMO System
% For this example, create a 2-output, 3-input system.

rng(0,'twister');
H = rss(4,2,3);

% For this system, nichols plots the frequency responses of each I/O channel in a separate plot in a single figure.

nichols(H)

% Compute the magnitude and phase of these responses at 20 frequencies between 1 and 10 radians.

w = logspace(0,1,20);
[mag,phase] = nichols(H,w);

% mag and phase are three-dimensional arrays, in which the first two dimensions correspond to the output and input dimensions of H, and the third dimension is the number of frequencies. For instance, examine the dimensions of mag.

size(mag)

% Thus, for example, mag(1,3,10) is the magnitude of the response from the third input to the first output, computed at the 10th frequency in w. Similarly, phase(1,3,10) contains the phase of the same response.
% Copyright 2021 The MathWorks, Inc.