P. 1
Matlab code for implementation of routhharwitz table table

Matlab code for implementation of routhharwitz table table

|Views: 1,822|Likes:

Availability:

See more
See less

05/20/2013

pdf

text

original

Assignment#03

S ubject :
Control Systems
S ubmitted B y :
Naveed Mazhar
R egistration N o. :
FA09-BEE-143

S ubmitted T o :
Sir Shahid Mustafa
Date: 23
rd
Ar!l"2012
Question No.:01
Construct the Routh Hurwitz Table for given Polynoial !ascen"ing or"er of "egree# using \$atlab
2 3 4 5 6 7 8 9 10
11 14 15 16 17 18 19 20
1+143s+(143s) +(143s) +(143s) +(143s) +(143s) +(143s) +(143s) +(143s) (143s)
(143s) +(143s) +(143s) +(143s) +(143s) +(143s) +(143s) +(143s)
+
+
\$%T&%' \$()*&+
clc;clear all; A=0; n=input('Enter the degree of polynomial::::');
c=input('Enter Coefficients of polynomial in ascending order::::');
c=fliplr(c); %%flip the row ector to arrange in descending order
m=ceil((n!")#\$); %%%he no& of columns of %a'le
%%Enter first \$ rows of ()* %a'le
for +=":m
for i=":\$
A(i,+)=c(\$-+!i)\$);
if (\$-+!i)\$)==length(c)
c(",\$-+!i)")=0;
end
end
end
m=m)";
for i=.:n!"
if A(i)",")==0
if A(i)",:)==0 %%Chec/ for full row to 'e 0ero
11=A(i)\$,:); g=n)i!2;E1=0;
disp(3'4ero row is found at 56' int\$str(g)\$)7);
for 8=":\$:g
E1(8)=11((8!")#\$);
end
if length(E1)9g
E1(g)=0;
end
der:E1=polyder(E1);
der=der:E1(":\$:length(der:E1));
A(i)",:)=3der 0eros(",m!")length(der))7;
else
A(i)",")="e).; %%Change the first column entry
end
end
for +=":m
A(i,+)= )det(3A(i)\$,"),A(i)\$,+!");A(i)","),A(i)",+!")7)#A(i)",");
end
end
disp('(outh *urwit0 %a'le is::::'),disp(A)
c"=A(:,")', c"(c";")=";c"(c"9")=0; %%%Access Contents of "
st
column
<=length(find(diff(c")==0));
disp(3'<o of sign changes::::' int\$str(<)7);
C,\$\$%N- .*N-,.
Enter the degree of polynomial::::\$0
Enter Coefficients of polynomial in ascending order::::3" "2. "2.6\$ "2.6.
"2.62 "2.6> "2.6? "2.6@ "2.6A "2.6B "2.6"0 "2.6"" "2.6"\$ "2.6". "2.6"2
"2.6"> "2.6"? "2.6"@ "2.6"A "2.6"B "2.6\$07;
<o of sign changes::::"0
**Table was also displayed on Command Window but I have shown it from
workspace.
.or/01ace
Question No.:02
Generate the Routh Hurwitz Tabe !or "i#en \$o%no&ia (in 'es(en'in" or'er o! 'e"ree o!
)o%no&ia) usin" *+T,+-.
20 19 18 17 16 15 14 11 10 9 8 7 6 5 4 3 2
s +34s +12s +23s +6s +78s +6s s s +88s +7s +4s +3s +2s +2s +5s +4s +3s+1 − −
\$%T&%' \$()*&+
clc;clear all;c=0;A=0;
n=input('Enter the degree of polynomial::::');
c=input('Enter Coefficients of polynomial in descending order::::');
m=ceil((n!")#\$);
for +=":m
for i=":\$
A(i,+)=c(\$-+!i)\$);
if (\$-+!i)\$)==length(c)
c(",\$-+!i)")=0;
end
end
end
m=m)";
for i=.:n!"
if A(i)",")==0
if A(i)",:)==0
11=A(i)\$,:);g=n)i!2;E1=0;
disp(3'4ero row is found at 56' int\$str(g)\$)7);
for 8=":\$:g
E1(8)=11((8!")#\$);
end
if length(E1)9g
E1(g)=0;
end
der:E1=polyder(E1);
der=der:E1(":\$:length(der:E1));
A(i)",:)=3der 0eros(",m!")length(der))7;
else
A(i)",")="e).;
end
end
for +=":m
A(i,+)= )det(3A(i)\$,"),A(i)\$,+!");A(i)","),A(i)",+!")7)#A(i)",");
end
end
disp('(outh *urwit0 %a'le is::::'),disp(A)
c"=A(:,")', c"(c";")=";c"(c"9")=0;
<=length(find(diff(c")==0));
disp(3'<o of sign changes::::' int\$str(<)7);
C,\$\$%N- .*N-,.
Enter the degree of polynomial::::\$0
Enter Coefficients of polynomial in descending order::::3" .2 "\$ \$. ? @A
? 0 0 )" )" AA @ 2 . \$ \$ > 2 . "7
(outh *urwit0 %a'le is::::
Columns 1 through 7
"&0000 "\$&0000 ?&0000 ?&0000 0 )"&0000 @&0000
.2&0000 \$.&0000 @A&0000 0 )"&0000 AA&0000 2&0000
""&.\$.> .&@0>B ?&0000 0&0\$B2 ).&>AA\$ ?&AA\$2 \$&B2"\$
""&A@\$@ >B&BA22 )0&0AA. B&@@20 ?@&..>" )2&A."\$ ).&>?.?
)>.&>0.A ?&0A2\$ )B&\$B\$> )?@&A0A? ""&2B00 ?&.200 A&\$A?2
?"&..2> )\$&">02 )>&\$@.0 ?B&AA2A ).&2\$2. )"&@\$2B )>&A@?B
2&\$0A2 )".&AB\$. )?&A2?" A&>0\$B 2&A.>. .&">BA 2&"0>>
\$00&."B2 B2&>02? )>2&0.B. )@.&AB>@ )2@&@@?B )?>&@"\$. )"2&.>>0
)">&A@@@ )>&@"0B "0&0>>2 >&A.B" 2&>20. 2&20@" "&0000
\$\$&2>20 @\$&A\$.> )0&\$\$@A B&>0>B )"0&""0" )"&@.A> 0
2>&@A2" B&AB2. "\$&>?0A )\$&?0A@ .&"@@A "&0000 0
?@&B@"0 )?&.AA0 "0&@A>. )""&??A? )\$&\$\$B0 0 0
"2&"B@\$ >&\$B?" >&\$>"0 2&?@B\$ "&0000 0 0
)."&@2.A )"2&.>2A ).2&0@0A )@&0"?? 0 0 0
)"&"\$20 )B&BA?B "&>2"0 "&0000 0 0 0
\$?@&?B0B )@@&>B\$0 ).>&\$>A\$ 0 0 0 0
)"0&."\$@ "&.B.0 "&0000 0 0 0 0
)2"&2..@ )B&.00A 0 0 0 0 0
.&@0@B "&0000 0 0 0 0 0
"&A@.? 0 0 0 0 0 0
"&0000 0 0 0 0 0 0
Columns through 11
.&0000 \$&0000 2&0000 "&0000
\$&0000 >&0000 .&0000 0
"&A>\$B .&B""A "&0000 0
)?&@2>> )0&00\$? 0 0
.&B"2\$ "&0000 0 0
0&\$"B. 0 0 0
"&0000 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
c" =
Columns 1 through 7
"&0000 .2&0000 ""&.\$.> ""&A@\$@ )>.&>0.A ?"&..2> 2&\$0A2
Columns through 1!
\$00&."B2 )">&A@@@ \$\$&2>20 2>&@A2" ?@&B@"0 "2&"B@\$ )."&@2.A
Columns 1" through #1
)"&"\$20 \$?@&?B0B )"0&."\$@ )2"&2..@ .&@0@B "&A@.? "&0000
<o of sign changes::::A
*nter1retation of table
1/0o1 o! si"n (han"es is e2ua to nu&ber o! )oes in ri"ht ha! )ane1
2/+s the )ro"ra& aso in'i(ates the zero row1 3o obser#in" the out)ut 4(15 (1
st
(ou&n) )oes on the 46w5 a7is
(an be se)arate'1 The% are e2ua to no1 o! si"n (han"es a!ter zero row1
3/ 8! 4a5 no1 o! )oes ie in R1H1\$1 an' 4b5 )oes ie on 46w5 a7is then !or 4n5 'e"ree )o%no&ia9 4(:n/a/b5
)oes wi be in ,1H1\$1
8n ;<019 there are 10 si"n (han"es with no zero row1 3o 10 )oes in R1H1\$1 an' 10 in ,1H1\$1
8n ;<029 a"ain there is no zero row1 3o9 8 )oes ie in R1H1\$1 an' 12 in ,1H1\$1

scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->