You are on page 1of 7

SABARIVELAN S

20BEI0059

EXPERIMENT-4
AIM:
To apply Routh-Hurwitz criteria for analysing stability of a control system.

SOFTWARE USED:
MATLAB

PROBLEM STATEMENT:
THEORETICAL SOLUTION:
MATLAB CODE:
clc
clear
close all
order=input('Enter the order of the equation: ');
Noc=1+order %number of coefficents
charequation=input('Enter the coefficients: ');
routh_table=[];
first_row=[];
second_row=[];
d=1;
for i=1:length(charequation)
if d~=sign(charequation(i))
disp('Not satisfing first condition')
return
end
end

if d==sign(charequation(i))
for i=1:2:Noc
first_row=[first_row,charequation(i)];
end
while length(first_row)<=2
first_row=[first_row,0];
end
routh_table=[routh_table,first_row]
for i=2:2:Noc

second_row=[second_row,charequation(i)];
end
while length(second_row)<length(first_row)
second_row=[second_row,0];
end
routh_table=[routh_table;second_row]
required_row=length(charequation)-2;
routh_table_width=length(first_row);
for looprow=1:required_row
row=[];
divisor=routh_table(looprow+1,1);
left_det =
routh_table(looprow:looprow+1,1);
for col=1:routh_table_width
if col==routh_table_width
right_det=[0;0];
else

right_det=routh_table(looprow:looprow+1,col+1);
end
fdet=[left_det,right_det];
value=-det(fdet)/divisor;
row=[row,value];
end
routh_table=[routh_table;row]
end
first_column=routh_table(:,1);
s=sign(first_column(1));
unstable=0;
for i=2:length(first_column)
value=first_column(i);
if s~=sign(value)
disp('system is unstable ')
unstable = 1;
break
end
end
if ~unstable
disp('System is stable')
end
end
SIMULATION RESULT:

RESULT ANALYSIS:
The order of the equation and the coefficients of the polynomial are obtained from the user
to build the routh table. The code will run only for the R-H polynomial. We can obtain the
characteristic equation from the given forward path gain. For the 2nd and 3rd problem
statement the value of K determines the stability of the system. If the k value is less than 0
then the system is unstable. And K value between 0 to 7.778 gives a stable system. K value
after 7.78 gives marginally stable system.

CONCLUSION:
Therefore, the routh table is obtained from MATLAB code and theoretical solution.

You might also like