%% Frequency-Response Data Model with Negative Frequencies
% You can specify negative frequency values in an frd object. This capability is useful when you want to capture the frequency response data of models with complex coefficients.
% Create a frequency vector with both positive and negative values.

w0 = sort([-logspace(-2,2,50) 0 logspace(-2,2,50)]);

% Create a state-space model with complex coefficients.

A = [-3.50,-1.25-0.25i;2,0];
B = [1;0];
C = [-0.75-0.5i,0.625-0.125i];
D = 0.5;
Gc = ss(A,B,C,D);

% Convert the model to an frd model at the specified frequencies.

sys = frd(Gc,w0);

% Plot the frequency response of the models.

bode(Gc,'b',sys,'r--')

% The plot responses match closely. 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.
% Copyright 2021 The MathWorks, Inc.