%% Right Normalized Coprime Factorization of SISO System
% Compute the right normalized coprime factorization of a SISO system.

sys = zpk([1 -1+2i -1-2i],[-1 2+1i 2-1i],1);
[fact,Mr,Nr] = rncf(sys);

%
% Examine the original system and its factors.

sys
zpk(Mr)
zpk(Nr)

%
% The numerators of the factors Mr and Nr are the denominator and numerator of sys, respectively. Thus, sys = Nr/Mr. rncf chooses the denominators of the factors such that the system \left\lbrack M_r \left(j\omega \right);N_r \left(j\omega \right)\right\rbrack is a unit vector at all frequencies. To confirm that property of the factorization, examine the singular values of fact, which is a stable minimal realization of \left\lbrack M_r \left(j\omega \right);N_r \left(j\omega \right)\right\rbrack.

sigma(fact)

% Within a small numerical error, the singular value of fact is 1 (0 dB) at all frequencies.
%
% Copyright 2018 The MathWorks, Inc.
%
%
%