%% Implicit Factorization
% Consider the following discrete-time system.

F = zpk(-1.76,[-1+i -1-i],-4,0.002);

%
% F has poles and zeros outside the unit circle. Use spectralfact to compute a system G with stable poles and zeros, such that G'*G = F'*F.

G = spectralfact(F,[])

%
% Unlike F, G has no poles or zeroes outside the unit circle.  G does have an additional zero at z = 0, which is a reflection of the unstable zero at z = Inf in F.

pzplot(G)

%
% Confirm that G'*G = F'*F by comparing the original factorization to the difference between the two factorizations. The singular values of the difference are far below those of the original factorization.

Ff = F'*F;
Gf = G'*G;
sigmaplot(Ff,Ff-Gf)

% Copyright 2012 The MathWorks, Inc.