from
synthesis
by Evgeny Veremey Solves SISO mean-square optimal control design problems: A(p)x = B(p)u + f(t)
[PolRight,PolLeft]=gurnogur(Pol)
function [PolRight,PolLeft]=gurnogur(Pol)
%Here is the separation of a polynomial into Hurwitz and non-Hurwitz polynomials.
rootsPol=mysort(roots(Pol));
k1=length(rootsPol);
k2=0;
for i=1:k1
if rootsPol(i)>=0
k2=k2+1;
end
end
if k2>0
i=(k1-k2+1):k1 ;rootsPolRight=rootsPol(i);
PolRight=sqrt(abs(Pol(1)))*poly(rootsPolRight);
PolLeft=deconv(Pol,PolRight);
else PolRight=[1];PolLeft=Pol;
end;