%This is made by using a equation in Multivariable feedback control page
%176.
function [Gs1 Gm1 Gms1]=gms1(G1)

ztot=zero(G1); ptot=pole(G1);
z=ztot(find((ztot>0))); p=ptot(find((ptot>0)));
nz=length(z); np=length(p);

s=TF('s');
b=1;a=1;     
for i = 1:np
    b=b*(s-p(i))/(s+p(i));
end;
for i = 1:nz
    a=a*(s+z(i))/(s-z(i));
end    

Gs1=minreal(tf(b*G1));Gm1=minreal(tf(G1*a)); Gms1=minreal(tf(b*G1*a));