function [Gds2 Gdm2 Gdms2]=gmsd2(Gdtest2)

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

Gds2=minreal(tf(b*Gdtest2)); Gdm2=minreal(tf(Gdtest2*a)); Gdms2=minreal(tf(b*Gdtest2*a));