summaryrefslogtreecommitdiff
path: root/162/CH8/EX8.7/example87.sce
blob: f4d2e509bc35cf31ac22c36a6df69590fd203707 (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
31
32
33
34
35
36
37
//Example 8.7
clc;
// Define the polynomial
s=poly(0,"s");
p=8+4*s+4*s^2+2*s^3+2*s^4+s^5;
// Calculate the routh of above polynomial
r=routh_t(p);
S=roots(p);
disp(r,"Routh array=");
disp(S,"Roots=");
A=r(:,1);
c=0;
x=0;
for i=1:5
    x=A(i,1);
    if x<0
        c=c+1;
    end
end
if(c>=1) then
   printf("system is unstable");
else 
    l=length(S);
    c=0;
    for i=1:l
        a=S(i,1);
        r=real(a);
        if r<0 then
            c=c+1;
        end
    end
    if c==0 then
        printf("system is stable");
    else
        printf("system is unstable");
    end
end