Sunday 17 September 2017

MATLAB Program for Stability of a System Using Routh-Hurwitz Criterion

Stability of any system is an important issue. we have several methods to find out the stability of any system Routh-Hurwitz Criterion is one of them, we can check the stability of system using Routh Matrix.
Routh- Hurwitz Criterion state that 

"The system is stable if and only if all the elements in the first column have same algebaric sign. If all elements are not of the same sign then the number of sign change of the elements  in first column equals the number of rots of characteristic equation in the right half of S-plane"


Using MATLAB can check the stability of any system on the bases of Routh-Hurwitz Criterion with the help of following program:


%% routh hurwitz criteria
clear
clc
%% firstly it is required to get first two row of routh matrix
e=input('enter the coefficients of characteristic equation: ');
disp('-------------------------------------------------------------------------')
l=length(e);
m=mod(l,2);
if m==0
    a=rand(1,(l/2));
    b=rand(1,(l/2));
    for i=1:(l/2)
        a(i)=e((2*i)-1);
        b(i)=e(2*i);
    end
else
    e1=[e 0];
    a=rand(1,((l+1)/2));
    b=[rand(1,((l-1)/2)),0];
    for i=1:((l+1)/2)
        a(i)=e1((2*i)-1);
        b(i)=e1(2*i);
    end
end
%% now we genrate the remaining rows of routh matrix
l1=length(a);
c=zeros(l,l1);
c(1,:)=a;
c(2,:)=b;
for m=3:l
    for n=1:l1-1
        c(m,n)=-(1/c(m-1,1))*det([c((m-2),1) c((m-2),(n+1));c((m-1),1) c((m-1),(n+1))]);
    end
end
disp('the routh matrix:')
disp(c)
%% now we check the stablity of system
if c(:,1)>0
    disp('System is Stable')
else
    disp('System is Unstable');
end

No comments:

Post a Comment