function [Gs3 Gm3 Gms3]=gms3(G3)

ztot=pole(G3); ptot=pole(G3);
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    

Gs3=minreal(tf(b*G3));Gm3=minreal(tf(G3*a)); Gms3=minreal(tf(b*G3*a));