function [Gds31 Gdm31 Gdms31]=gmsd31(Gd31)

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

Gds31=minreal(tf(b*Gd31));Gdm31=minreal(tf(Gd31*a)); Gdms31=minreal(tf(b*Gd31*a));