You are on page 1of 3

%TheRouthHurwitzstabilitycriterionisanecessary(andfrequently

%sufficient)methodtoestablishthestabilityofasingleinput,
%singleoutput(SISO),lineartimeinvariant(LTI)controlsystem.
%Moregenerally,givenapolynomial,somecalculationsusingonlythe
%coefficientsofthatpolynomialcanleadustotheconclusionthatit
%isnotstable.
%inthisprogramyoumustgiveyoursystemcoefficentsandthe
%RouthHurwitztablewouldbeshown
%
%FarzadSagharchi,Iran
%2007/11/12

r=input('inputvectorofyoursystemcoefficents:');
tic
m=length(r);
n=round(m/2);
q=1;
k=0;
forp=1:length(r)
ifrem(p,2)==0
c_even(k)=r(p);
else
c_odd(q)=r(p);

k=k+1;
q=q+1;
end
end
a=zeros(m,n);

ifm/2~=round(m/2)
c_even(n)=0;
end
a(1,:)=c_odd;
a(2,:)=c_even;
ifa(2,1)==0
a(2,1)=0.01;
end
fori=3:m
forj=1:n1
x=a(i1,1);
ifx==0
x=0.01;
end

a(i,j)=((a(i1,1)*a(i2,j+1))(a(i2,1)*a(i1,j+1)))/x;

end
ifa(i,:)==0
order=(mi+1);
c=0;
d=1;
forj=1:n1
a(i,j)=(orderc)*(a(i1,d));
d=d+1;
c=c+2;
end
end
ifa(i,1)==0
a(i,1)=0.01;
end
end
Right_poles=0;
fori=1:m1
ifsign(a(i,1))*sign(a(i+1,1))==1
Right_poles=Right_poles+1;
end
end
toc
fprintf('\nRouthHurwitzTable:\n')
display(a)
fprintf('\nNumberOfRightPoles=%2.0f\n',Right_poles)

reply=input('DoYouNeedRootsofSystem?Y/N','s');
ifreply=='y'||reply=='Y'
ROOTS=roots(r);
fprintf('\nGivenPolynomialsCoefficentsRoots:\n')
display(ROOTS)
else
end

functionRouthHurwitz2
r=input('inputvectorofyoursystemcoefficents:');
tic
m=length(r);
n=round(m/2);
q=1;
k=0;
c_even=r(rem(r,2)==0);
c_odd=r(rem(r,2)~=0);

a=zeros(m,n);

ifm/2~=round(m/2)
c_even(n)=0;
end
a(1,:)=c_odd;
a(2,:)=c_even;
ifa(2,1)==0
a(2,1)=0.01;
end
fori=3:m
forj=1:n1
x=a(i1,1);
ifx==0
x=0.01;
end

a(i,j)=((a(i1,1)*a(i2,j+1))(a(i2,1)*a(i1,j+1)))/x;

end
ifa(i,:)==0
order=(mi+1);
c=0;
d=1;
forj=1:n1
a(i,j)=(orderc)*(a(i1,d));
d=d+1;
c=c+2;
end
end
ifa(i,1)==0
a(i,1)=0.01;
end
end
ROOTS=roots(r);
Right_poles=length(ROOTS(ROOTS>=0));
toc
fprintf('\nRouthHurwitzTable:\n')
display(a)
fprintf('\nNumberOfRightPoles=%2.0f\n',Right_poles)

reply=input('DoYouNeedRootsofSystem?Y/N','s');
ifreply=='y'||reply=='Y'
fprintf('\nGivenPolynomialsCoefficentsRoots:\n')
display(ROOTS)
else
end
end

You might also like