summaryrefslogtreecommitdiff
path: root/46/CH14/EX14.4/Example14_4.sce
blob: 1a891762078a289631d7d8137dfb6fe4da5f2aac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Example 14.4
clc
s=%s;
tau1=1;
tau2=1/2;
tau3=1/3;
taui=0.25;
Kc=5;
n=Kc/(tau1*tau2*tau3)*(taui*s+1);
d=taui*s*(s+(1/tau1))*(s+(1/tau2))*(s+(1/tau3));
G=syslin('c',n/d);
//The characteristic equation is therefore
disp('1+G=0')
disp('=0',1+G,'1+G=');
//which is equivalent to
disp("s^4+6*s^3+11*s^2+36*s+120=0")
h=poly([120 36 11 6 1],'s','coeff')
r=routh_t(h)
y=coeff(h);
n=length(y);
c=0;
for i=1:n
if (r(i,1)<0)
c=c+1;
end 
end
if(c>=1)
printf("system is unstable\n")
else ("system is stable")
end