%% Obtain Real and Imaginary Parts of Frequency Response
% Compute the real and imaginary parts of the frequency response of a SISO system.
% If you do not specify frequencies, nyquist chooses frequencies based on the system dynamics and returns them in the third output argument.

H = tf([2 5 1],[1 2 3]);
[re,im,wout] = nyquist(H);

% Because H is a SISO model, the first two dimensions of re and im are both 1. The third dimension is the number of frequencies in wout.

size(re)
length(wout)

% Thus, each entry along the third dimension of re gives the real part of the response at the corresponding frequency in wout.
% Copyright 2021 The MathWorks, Inc.