Automatic Control Systems - B. C. Kuo and F. Golnaraghi
Automatic Control Systems - B. C. Kuo and F. Golnaraghi
Automatic Control Systems - B. C. Kuo and F. Golnaraghi
Golnaraghi 1
Created by Arpita V Huddar B.Tech (pursuing) Electronics Engineering NIT Karnataka College Teacher S.Rekha Cross-Checked by Sonanya Tatikola, IITB August 9, 2013
by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab codes written in it can be downloaded from the Textbook Companion Project section at the website http://scilab.in
1 Funded
Book Description
Title: Automatic Control Systems Author: B. C. Kuo And F. Golnaraghi Publisher: Princton Hall Of India Private Limited, New Delhi Edition: 7 Year: 1995 ISBN: 81-203-0968-5
Scilab numbering policy used in this document and the relation to the above book. Exa Example (Solved example) Eqn Equation (Particular equation of the above book) AP Appendix to Example(Scilab Code that is an Appednix to a particular Example of the above book) For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means a scilab code whose theory is explained in Section 2.3 of the book.
Contents
List of Scilab Codes 2 Mathematical Foundation 3 Transfer Functions Block Diagrams and Signal Flow Graphs 4 Mathematical Modelling of Physical Systems 5 State Variable Analysis 6 Stability of Linear Control Systems 7 Time Domain Analysis of Control Systems 8 Root Locus Technique 9 Frequency Domain Analysis 4 9 18 26 31 37 44 53 81
Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa
3.9 3.10 3.11 4.1 4.2 4.3 4.4 4.5 4.9 5.1 5.7 5.8 5.9 5.12 5.13 5.14 5.18 5.19 5.20 5.21 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 6.10 7.1 7.2 7.3 7.4 7.5 7.6 8.1 8.2
masons gain formula . . . . . . . . . . . . . . . . masons gain formula . . . . . . . . . . . . . . . . masons gain formula . . . . . . . . . . . . . . . . transfer fnuction of system . . . . . . . . . . . . transfer fnuction of electric network . . . . . . . gear trains . . . . . . . . . . . . . . . . . . . . . mass spring system . . . . . . . . . . . . . . . . . mass spring system . . . . . . . . . . . . . . . . . incremental encoder . . . . . . . . . . . . . . . . state transition equation . . . . . . . . . . . . . . characteristic equation from transfer function . . characteristic equation from state equation . . . eigen values . . . . . . . . . . . . . . . . . . . . . ccf form . . . . . . . . . . . . . . . . . . . . . . . ocf form . . . . . . . . . . . . . . . . . . . . . . . dcf form . . . . . . . . . . . . . . . . . . . . . . . system with identical eigen values . . . . . . . . controllability . . . . . . . . . . . . . . . . . . . . controllability . . . . . . . . . . . . . . . . . . . . observability . . . . . . . . . . . . . . . . . . . . stability of open loop systems . . . . . . . . . . . rouths tabulation to determine stability . . . . . rouths tabulation to determine stability . . . . . rst element in any row of rouths tabulation is z elements in any row of rouths tabulations are all determining critical value of K . . . . . . . . . . determining critical value of K . . . . . . . . . . stability of closed loop systems . . . . . . . . . . bilinear transformation method . . . . . . . . . . bilinear transformation method . . . . . . . . . . type of system . . . . . . . . . . . . . . . . . . . steady state errors from open loop tf . . . . . . . steady state errors from closed loop tf . . . . . . steady state errors from closed loop tf . . . . . . steady state errors from closed loop tf . . . . . . steady state errors from closed loop tf . . . . . . poles and zeros . . . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22 23 24 26 27 27 28 28 29 31 32 32 32 33 33 34 35 35 35 36 37 38 38 39 39 40 41 42 42 43 44 44 46 47 49 51 53 53
Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa
8.3 8.4 8.5 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.20 8.21 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.14 9.15 9.17
root locus . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . angle of departure and angle of arrivals multiple order pole . . . . . . . . . . . . intersection of root loci with real axis . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . root sensitivity . . . . . . . . . . . . . . calculation of K on root loci . . . . . . . properties of root loci . . . . . . . . . . eect of addition of poles to system . . eect of addition of zeroes to system . . eect of moving poles near jw axis . . . eect of moving poles awat from jw axis nyquist plot . . . . . . . . . . . . . . . . nyquist plot . . . . . . . . . . . . . . . . stability of non minimum phase loop tf . stability of minimum phase loop tf . . . stability of non minimum phase loop tf . stability of non minimum phase loop tf . stability of non minimum phase loop tf . eect of addition of poles . . . . . . . . eect of addition of zeroes . . . . . . . . multiple loop systems . . . . . . . . . . gain margin and phase margin . . . . . bode plot . . . . . . . . . . . . . . . . . relative stability . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56 57 58 59 59 61 63 63 65 67 67 68 71 71 72 76 76 81 81 84 86 86 89 89 91 91 94 97 100 100
List of Figures
8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.20 8.21 8.22 9.1 9.2 9.3 9.4 9.5 9.6 poles and zeros . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . root locus . . . . . . . . . . . . . . . . . angle of departure and angle of arrivals . intersection of root loci with real axis . . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . breakaway points . . . . . . . . . . . . . root sensitivity . . . . . . . . . . . . . . root sensitivity . . . . . . . . . . . . . . calculation of K on root loci . . . . . . . eect of addition of poles to system . . . eect of addition of poles to system . . . eect of addition of zeroes to system . . eect of addition of zeroes to system . . eect of moving poles near jw axis . . . . eect of moving poles near jw axis . . . . eect of moving poles awat from jw axis eect of moving poles awat from jw axis nyquist plot . . . . . . . . . . . . . . . nyquist plot . . . . . . . . . . . . . . . stability of non minimum phase loop tf stability of minimum phase loop tf . . stability of non minimum phase loop tf stability of non minimum phase loop tf 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 55 56 57 58 60 61 62 64 65 66 68 69 70 72 73 74 75 77 78 79 80 82 83 84 85 87 88
stability of non minimum phase loop tf eect of addition of poles . . . . . . . . eect of addition of poles . . . . . . . . eect of addition of zeroes . . . . . . . eect of addition of zeroes . . . . . . . multiple loop systems . . . . . . . . . . gain margin and phase margin . . . . . bode plot . . . . . . . . . . . . . . . . relative stability . . . . . . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
90 92 93 94 95 96 98 99 101
unit function
// f i n a l v a l u e t h e r e o m syms s 9
3 4 5 6 7 8 9
d = poly ([0 2 1 1] , s , c o e f f ) n = poly ([5] , s , c o e f f ) f=n/d; disp (f , F ( s )= ) x=s*f; y = limit (x ,s ,0) ; // f i n a l v a l u e t h e o r e m disp (y , f ( i n f )= )
o f s p l a n e , f i n a l v a l u e t h e r e o m c a n n o t be a p p l i e d in t h i s case )
10
// i n v e r s e l a p l a c e t r a n s f o r m n = poly ([4] , s , c o e f f ) d = poly ([4 8 1] , s , c o e f f ) G=n/d; disp (G , G( s )= ) pf = pfss ( G ) disp ( pf , G( s )= ) syms s t g1 = ilaplace ( pf (1) ,s , t ) g2 = ilaplace ( pf (2) ,s , t ) disp ( g1 + g2 , g ( t )= )
//w=2 , damping r a t i o =2
// i n v e r s e l a p l a c e t r a n s f o r m n = poly ([5 -1 -1] , s , c o e f f ) d = poly ([0 -1 -2] , s , r o o t s ) Y=n/d; disp (Y , Y( s )= ) pf = pfss ( Y ) disp ( pf , Y( s )= ) syms s t y1 = ilaplace ( pf (1) ,s , t ) y2 = ilaplace ( pf (2) ,s , t ) y3 = ilaplace ( pf (3) ,s , t ) disp ( y1 + y2 + y3 , g ( t )= ) l = limit ( Y *s ,s ,0) disp (l , l i m i t o f y ( t ) a s t t e n d s t o i n f i n i t y = )
1 2 3 4 5 6 7 8 9 10 11 12
// i n v e r s e l a p l a c e t r a n s f o r m n = poly ([1000] , s , c o e f f ) d = poly ([0 1000 34.5 1] , s , c o e f f ) Y=n/d; disp (Y , Y( s )= ) pf = pfss ( Y ) disp ( pf , Y( s )= ) syms s t y1 = ilaplace ( pf (1) ,s , t ) y2 = ilaplace ( pf (2) ,s , t ) y3 = ilaplace ( pf (3) ,s , t ) disp ( y1 + y2 + y3 , y ( t )= )
// a d j o i n t o f a m a t r i x 12
// e q u a l i t y o f m a t r i c e s A =[1 2;3 4] B =[1 2;3 4] x =1; for i =1:2 for j =1:2 if A (i , j ) ~= B (i , j ) then x =0 end end end if x ==1 then disp ( m a t r i c e s a r e e q u a l ) else disp ( m a t r i c e s a r e n o t e q u a l ) end
13
// c o n f o r m a b l i l i t y f o r m u l t i p l i c a t i o n o f m a t r i c e s A =[1 2 3;4 5 6] B =[1 2 3] C = size ( A ) D = size ( B ) if C (1 ,2) == D (1 ,1) then disp ( m a t r i c e s are conformable for m u l t i p l i c a t i o n AB ) else disp ( m a t r i c e s are not conformable f o r m u l t i p l i c a t i o n AB ) end if D (1 ,2) == C (1 ,1) then disp ( m a t r i c e s are conformable for m u l t i p l i c a t i o n BA ) else disp ( m a t r i c e s are not conformable f o r m u l t i p l i c a t i o n BA ) end
// m u l t i p l i c a t i o n o f m a t r i c e s A =[3 -1;0 1;2 0] B =[1 0 -1;2 1 0] C = size ( A ) D = size ( B ) if C (1 ,2) == D (1 ,1) then AB = A * B disp ( AB , AB= ) 14
9 10
11 end 12 if D (1 ,2) == C (1 ,1) then 13 BA = B * A 14 disp ( BA , BA= ) 15 else 16 disp ( m a t r i c e s are not conformable
for
m u l t i p l i c a t i o n BA )
17 end
matrix doesnt e x i s t
)
9 end
15
7 8
else disp ( i n v e r s e o f a s i n g u l a r m a t r i x d o e s n t e x i s t )
9 end
// r a n k o f a m a t r i x A =[0 1;0 1] [E ,Q , Z , stair , rk1 ]= ereduc (A ,1. d -15) disp ( rk1 , r a n k o f A= ) B =[0 5 1 4;3 0 3 2] [E ,Q , Z , stair , rk2 ]= ereduc (B ,1. d -15) disp ( rk2 , r a n k o f B= ) C =[3 9 2;1 3 0;2 6 1] [E ,Q , Z , stair , rk3 ]= ereduc (C ,1. d -15) disp ( rk3 , r a n k o f C= ) D =[3 0 0;1 2 0;0 0 1] [E ,Q , Z , stair , rk4 ]= ereduc (D ,1. d -15) disp ( rk4 , r a n k o f D= )
16
)
4 syms z 5 l = limit ( sys *(1 - z ^ -1) ,z ,1) 6 disp (l , l i m i t a s k a p p r o a c h e s
i n f i n i t y = )
17
// c l o s e d l o o p t r a n s f e r f u n c t i o n m a t r i x s = %s G =[1/( s +1) -1/ s ;2 1/( s +2) ] H =[1 0;0 1] GH = G * H disp ( GH , G( s )H( s )= ) I =[1 0;0 1] x = I + GH y = inv ( x ) M=y*G disp (M , M( s )= )
Scilab code Exa 3.3 masons gain formula applied to SFG in gure 3 15
18
forward path // o n l y one l o o p and no non t o u c h i n g loops delta =1 - L11 delta1 =1 Y = M1 * delta1 / delta disp (Y , Y( s ) /R( s )= )
// masons g a i n f o r m u l a a p p l i e d t o SFG i n f i g u r e 3 8(d ) // two f o r w a r d p a t h s syms a12 a23 a24 a25 a32 a34 a43 a44 a45 M1 = a12 * a23 * a34 * a45 M2 = a12 * a25 // f o u r l o o p s L11 = a23 * a32 L21 = a34 * a43 L31 = a24 * a32 * a43 L41 = a44 // one p a i r o f non t o u c h i n g l o o p s L12 = a23 * a32 * a44 delta =1 -( L11 + L21 + L31 + L41 ) +( L12 ) delta1 =1 delta2 =1 -( L21 + L41 ) x =( M1 * delta1 + M2 * delta2 ) / delta disp (x , y5 / y1= ) // i f y2 i s o u t p u t node M1 = a12 delta1 =1 -( L21 + L41 ) y =( M1 * delta1 ) / delta 19
22
disp (y , y2 / y1= )
// mason s g a i n f o r m u l a a p p l i e d t o SFG i n f i g u r e 3 16 // y2 a s o u t p u t node syms G1 G2 G3 G4 G5 H1 H2 H3 H4 M1 =1 L11 = - G1 * H1 L21 = - G3 * H2 L31 = G1 * G2 * G3 * - H3 L41 = - H4 L12 = G1 * H1 * G3 * H2 L22 = G1 * H1 * H4 L32 = G3 * H2 * H4 L42 = - G1 * G2 * G3 * H3 * H4 L13 = - G1 * H1 * G3 * H2 * H4 delta =1 -( L11 + L21 + L31 + L41 ) +( L12 + L22 + L32 + L42 ) + L13 delta1 =1 -( L21 + L41 ) +( L32 ) x = M1 * delta1 / delta disp (x , y2 / y1= ) // y4 a s o u t p u t node M1 = G1 * G2 delta1 =1 -( L41 ) y = M1 * delta1 / delta disp (y , y4 / y1= ) // y6 o r y7 a s o u t p u t node M1 = G1 * G2 * G3 * G4 M2 = G1 * G5 delta1 =1 delta2 =1 -( L21 ) z =( M1 * delta1 + M2 * delta2 ) / delta disp (z , y6 / y1=y7 / y1= )
20
// mason s g a i n f o r m u l a a p p l i e d t o SFG i n f i g u r e 3 16 // y2 a s o u t p u t node syms G1 G2 G3 G4 G5 H1 H2 H3 H4 M1 =1 L11 = - G1 * H1 L21 = - G3 * H2 L31 = G1 * G2 * G3 * - H3 L41 = - H4 L12 = G1 * H1 * G3 * H2 L22 = G1 * H1 * H4 L32 = G3 * H2 * H4 L42 = - G1 * G2 * G3 * H3 * H4 L13 = - G1 * H1 * G3 * H2 * H4 delta =1 -( L11 + L21 + L31 + L41 ) +( L12 + L22 + L32 + L42 ) + L13 delta1 =1 -( L21 + L41 ) +( L32 ) x = M1 * delta1 / delta disp (x , y2 / y1= ) // y7 a s o u t p u t node M1 = G1 * G2 * G3 * G4 M2 = G1 * G5 delta1 =1 delta2 =1 -( L21 ) y =( M1 * delta1 + M2 * delta2 ) / delta disp (y , y7 / y1= ) z=y/x // ( y7 / y2 ) =( y7 / y1 ) / ( y2 / y1 ) disp (z , y7 / y2= )
// b l o c k d i a g r a m i s c o n v e r t e d t o SFG 21
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// mason s g a i n f o r m u l a a p p l i e d t o SFG i n f i g u r e 3 17 //E a s o u t p u t node syms G1 G2 G3 G4 H1 H2 M1 =1 L11 = - G1 * G2 * H1 L21 = - G2 * G3 * H2 L31 = - G1 * G2 * G3 L41 = - G1 * G4 L51 = - G4 * H2 delta =1 -( L11 + L21 + L31 + L41 + L51 ) delta1 =1 -( L21 + L51 + L11 ) x = M1 * delta1 / delta disp (x , E( s ) /R( s )= ) //Y a s o u t p u t node M1 = G1 * G2 * G3 M2 = G1 * G4 delta1 =1 delta2 =1 y =( M1 * delta1 + M2 * delta2 ) / delta disp (y , Y( s ) /R( s )= )
// f i n d i n g t r a n s f e r f u n c t i o n from s t a t e d i a g r a m by applying gain formula // s t a t e d i a g r a m i s shown i n f i f u r e 3 21 syms s // i n i t i a l c o n d i t i o n s a r e s s e t t o z e r o M1 = s ^ -1* s ^ -1 L11 = -3* s ^ -1 L21 = -2* s ^ -1* s ^ -1 delta =1 -( L11 + L21 ) delta1 =1 x = M1 * delta1 / delta disp (x , Y( s ) /R( s )= ) 22
// a p p l y i n g g a i n f o r m u l a t o s t a t e d i a g r a m 3 22 // r ( t ) , x1 ( t ) and x2 ( t ) a r e i n p u t n o d e s // y ( t ) i s o u t p u t node // s u p e r p o s i t i o n p r i n c i p l e h o l d s good syms s r x1 x2 // r ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =0 delta1 =1 delta =1 a =( M1 * delta1 ) / delta y1 = a * r disp ( y1 , y1 ( t )= ) // x1 ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =1 delta1 =1 b =( M1 * delta1 ) / delta y2 = b * x1 disp ( y2 , y2 ( t )= ) // x2 ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =0 delta1 =1 c =( M1 * delta1 ) / delta y3 = c * x2 disp ( y3 , y3 ( t )= ) disp ( y1 + y2 + y3 , y ( t )= )
23
Scilab code Exa 3.11 masons gain formula // a p p l y i n g g a i n f o r m u l a t o s t a t e d i a g r a m i n f i g u r e 3 23( b ) 2 // r ( t ) , x1 ( t ) , x2 ( t ) and x3 ( t ) a r e i n p u t n o d e s 3 // y ( t ) i s o u t p u t node 4 // s u p e r p o s i t i o n p r i n c i p l e h o l d s good
1 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
syms s a0 a1 a2 a3 r x1 x2 x3 // r ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =0 delta1 =1 L11 = - a0 * a3 delta =1 -( L11 ) a =( M1 * delta1 ) / delta y1 = a * r disp ( y1 , y1 ( t )= ) // x1 ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =1 delta1 =1 b =( M1 * delta1 ) / delta y2 = b * x1 disp ( y2 , y2 ( t )= ) // x2 ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 =0 delta1 =1 c =( M1 * delta1 ) / delta y3 = c * x2 disp ( y3 , y3 ( t )= ) // x3 ( t ) a s i n p u t node and y ( t ) a s o u t p u t node M1 = a0 delta1 =1 d =( M1 * delta1 ) / delta y4 = d * x3 disp ( y4 , y4 ( t )= ) 24
36 37
disp ( y1 + y2 + y3 + y4 , y ( t )= )
25
// t r a n s f e r f u n c t i o n o f t h e s y s t e m // from s t a t e d i a g r a m i n 4 1(b ) // i n i t i a l c o n d i t i o n s a r e t a k e n a s z e r o // c o n s i d e r i n g v o l t a g e a c r o s s c a p a c i t o r a s o u t p u t syms R L C s = %s M1 =(1/ L ) *( s ^ -1) *(1/ C ) *( s ^ -1) L11 = -( s ^ -1) *( R / L ) delta =1 -( L11 ) delta1 =1 x = M1 * delta1 / delta disp (x , Ec ( s ) /E( s )= ) // c o n s i d e r i n g c u r r e n t i n t h e c i r c u i t a s o u t p u t M1 =(1/ L ) *( s ^ -1) delta1 =1 y = M1 * delta1 / delta disp (y , I ( s ) /E( s )= )
26
// t r a n s f e r f u n c t i o n o f e l e c t r i c n e t w o r k // from s t a t e d i a g r a m i n 4 2(b ) // i n i t a l c o n d i t i o n s a r e t a k e n a s z e r o // c o n s i d e r i n g i 1 a s o u t p u t syms R1 R2 L1 L2 C s = %s M1 =(1/ L1 ) *( s ^ -1) L11 = -( s ^ -1) *( R1 / L1 ) L21 = -( s ^ -1) *(1/ C ) *( s ^ -1) *(1/ L1 ) L31 = -( s ^ -1) *(1/ L2 ) *( s ^ -1) *(1/ C ) L41 = -( s ^ -1) *( R2 / L2 ) L12 = L11 * L31 L22 = L11 * L41 L32 = L21 * L41 delta =1 -( L11 + L21 + L31 + L41 ) +( L12 + L22 + L32 ) delta1 =1 -( L31 + L41 ) x = M1 * delta1 / delta disp (x , I 1 ( s ) /E( s )= ) // c o n s i d e r i n g i 2 a s o u t p u t M1 =(1/ L1 ) *( s ^ -1) *(1/ C ) *( s ^ -1) *(1/ L2 ) *( s ^ -1) delta1 =1 y = M1 * delta1 / delta disp (y , I 2 ( s ) /E( s )= ) // c o n s i d e r i n g v o l t a g e a c r o s s c a p a c i t o r a s o u t p u t M1 =(1/ L1 ) *( s ^ -1) *(1/ C ) *( s ^ -1) delta1 =1 - L41 z = M1 * delta1 / delta disp (z , Ec ( s ) /E( s )= )
1 2 3 4 5 6 7 8 9 10 11 12 13
// g e a r t r a i n s printf ( Given \ n i n e r t i a ( J2 ) =0.05 oz i n . s e c 2 \ n f r i c t i o n a l t o r q u e ( T2 ) =2oz i n . \ n N1/N2 ( r ) =1/5 ) J2 =0.05; disp ( J2 , J2= ) T2 =2; disp ( T2 , T2= ) r =1/5 disp (r , N1/N2= ) printf ( J1 =(N1/N2 ) 2 J2 \ n T1=(N1/N2 ) T2 ) J1 =( r ) ^2* J2 ; disp ( J1 , The r e f l e c t e d i n e r t i a on s i d e o f N1= ) T1 =( r ) * T2 disp ( T1 , The r e f l e c t e d coulumb f r i c t i o n i s = )
// mass s p r i n g s y s t e m // f r e e body d i a g r a m and s t a t e d i a g r a m a r e drawn a s shown i n f i g u r e 4 18( b ) and 4 18( c ) // a p p l y i n g g a i n f o r m u l a t o s t a t e d i a g r a m syms K M B s = %s M1 =(1/ M ) *( s ^ -2) L11 = -( B / M ) *( s ^ -1) L21 = -( K / M ) *( s ^ -2) delta =1 -( L11 + L21 ) delta1 =1 x = M1 * delta1 / delta disp (x , Y( s ) /F ( s )= )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// mass s p r i n g s y s t e m // f r e e body d i a g r a m and s t a t e d i a g r a m a r e drawn a s shown i n f i g u r e 4 19( b ) and 4 19( c ) // a p p l y i n g g a i n f o r m u l a t o s t a t e d i a g r a m syms K M B s = %s // c o n s i d e r i n g y1 a s o u t p u t M1 =(1/ M ) L11 = -( B / M ) *( s ^ -1) L21 = -( K / M ) *( s ^ -2) L31 =( K / M ) *( s ^ -2) delta =1 -( L11 + L21 + L31 ) delta1 =1 -( L11 + L21 ) x = M1 * delta1 / delta disp (x , Y1 ( s ) /F ( s )= ) // c o n s i d e r i n g y2 a s o u t p u t M1 =(1/ K ) *( K / M ) *( s ^ -2) delta1 =1 y = M1 * delta1 / delta disp (y , Y2 ( s ) /F ( s )= )
// i n c r e m e n t a l e n c o d e r // 2 s i n u s o i d a l s i g n a l s // g e n e r a t e s f o u r z e r o c r o s s i n g s p e r c y c l e ( z c ) // p r i n t w h e e l h a s 96 c h a r a c t e r s on i t s p h e r i p h e r y ( ch ) and e n c o d e r h a s 480 c y c l e s ( c y c ) zc =4 ch =96 cyc =480 zcpr = cyc * zc // z e r o c r o s s i n g s p e r r e v o l u t i o n disp ( zcpr , z e r o c r o s s i n g s p e r r e v o l u t i o n = ) zcpc = zcpr / ch // z r e o c r o s s i n g s p e r c h a r a c t e r disp ( zcpc , z e r o c r o s s i n g s p e r c h a r a c t e r = ) 29
30
// s t a t e t r a n s i t i o n e q u a t i o n // a s s e e n from s t a t e e q u a t i o n A=[0 1; 2 3] B = [ 0 ; 1 ] E=0; A =[0 1; -2 -3] B =[0;1] s = poly (0 , s ) ; [ Row Col ]= size ( A ) // S i z e o f a m a t r i x m = s * eye ( Row , Col ) -A // s I A n = det ( m ) //To Find The D e t e r m i n a n t o f s i A p = inv ( m ) ; // To Find The I n v e r s e Of s I A U =1/ s p=p*U syms t s ; disp (p , p h i ( s )= ) // R e s o l v e n t M a t r i x for i =1: Row for j =1: Col // Taking I n v e r s e L a p l a c e o f e a c h e l e m e n t o f M a t r i x phi ( s ) q (i , j ) = ilaplace ( p (i , j ) ,s , t ) ; end ; 31
function
// c h a r a c t e r i s t i c e q u a t i o n from s t a t e e q u a t i o n A =[0 1 0;0 0 1; -2 -1 -5] B =[0;0;1] C =[1 0 0] D =[0] [ Row Col ]= size ( A ) Gr = C * inv ( s * eye ( Row , Col ) -A ) * B + D c = denom ( Gr ) disp (c , c h a r a c t e r i s t i c e q u a t i o n= )
32
//OCF form s = %s A =[1 2 1;0 1 3;1 1 1] B =[1;0;1] [ row , col ]= size ( A ) c = s * eye ( row , col ) -A x = det ( c ) r = coeff ( x ) M =[ r (1 ,2) r (1 ,3) 1; r (1 ,3) 1 0;1 0 0] S =[ B A * B A ^2* B ] disp (S , c o n t r o l l a b i l i t y m a t r i x= ) if ( det ( S ) ==0) then printf ( s y s t e m c a n n o t be t r a n s f o r m e d i n t o c c f form ) else printf ( s y s t e m can be t r a n s f o r m e d i n t o c c f form ) end P=S*M disp (P , P= ) Accf = inv ( P ) * A * P Bccf = inv ( P ) * B disp ( Accf , A c c f= ) disp ( Bccf , B c c f= )
33
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
B =[1;0;1] C =[1 1 0] D =0 [ row , col ]= size ( A ) c = s * eye ( row , col ) -A x = det ( c ) r = coeff ( x ) M =[ r (1 ,2) r (1 ,3) 1; r (1 ,3) 1 0;1 0 0] V =[ C ; C * A ; C * A ^2] disp (V , o b s e r v a b i l i t y m a t r i x= ) if ( det ( V ) ==0) then printf ( s y s t e m c a n n o t be t r a n s f o r m e d i n t o o c f form ) else printf ( s y s t e m can be t r a n s f o r m e d i n t o o c f form ) end Q = inv ( M * V ) disp (Q , Q= ) Aocf = inv ( Q ) * A * Q Cocf = C * Q B = inv ( Q ) * B disp ( Aocf , A o c f= ) disp ( Cocf , C o c f= )
34
// s y s t e m w i t h i d e n t i c a l e i g e n v a l u e s A =[1 0;0 1] // lamda1=1 B =[2;3] // b11=2 b21=3 S =[ B A * B ] if det ( S ) ==0 then printf ( s y s t e m i s u n c o n t r o l l a b l e ) else printf ( s y s t e m i s c o n t o l l a b l e ) end
// c o n t r o l l a b i l i t y A =[ -2 1;0 -1] B =[1;0] S =[ B A * B ] if det ( S ) ==0 then printf ( s y s t e m i s u n c o n t r o l l a b l e ) else printf ( s y s t e m i s c o n t o l l a b l e ) end
35
i s u n c o n t r o l l a b l e ) i s c o n t o l l a b l e )
// o b s e r v a b i l i t y A =[ -2 0;0 -1] B =[3;1] C =[1 0] V =[ C ; C * A ] if det ( V ) ==0 then printf ( s y s t e m i s u n o b s e r v a b l e ) else printf ( s y s t e m i s o b s e r v a b l e ) end
36
z e r o e s i n RHP ) sys2 = syslin ( c ,20*( s +1) /(( s -1) *( s ^2+2* s +2) ) ) disp ( sys2 , M( s )= ) printf ( s y s 2 i s u n s t a b l e due t o p o l e a t s =1 ) sys3 = syslin ( c ,20*( s -1) /(( s +2) *( s ^2+4) ) ) disp ( sys3 , M( s )= ) printf ( s y s 3 i s m a r g i n a l l y s t a b l e o r m a r g i n a l l y u n s t a b l e due t o s=j 2 and s= j 2 ) sys4 = syslin ( c ,10/(( s +10) *( s ^2+4) ^2) ) disp ( sys4 , M( s )= ) printf ( s y s 4 i s u n s t a b l e due t o m u l t i p l e o r d e r p o l e a t s=j 2 and s= j 2 ) sys5 = syslin ( c ,10/( s ^4+30* s ^3+ s ^2+10* s ) ) disp ( sys5 , M( s )= ) 37
17
printf ( s y s 5 i s s t a b l e i n t e n t i o n a l l y )
i f p o l e a t s =0 i s p l a c e d
// r o u t h s t a b u l a t i o n s t o d e t e r m i n e s t a b i l i t y s = %s ; m = s ^3 -4* s ^2+ s +6; disp ( m ) r = coeff ( m ) n = length ( r ) routh = routh_t ( m ) // T h i s F u n c t i o n g e n e r a t e s t h e Routh table disp ( routh , r o u t h s t a b u l a t i o n= ) c =0; for i =1: n if ( routh (i ,1) <0) c = c +1; end end if (c >=1) printf ( s y s t e m i s u n s t a b l e ) else printf ( s y s t e m i s s t a b l e ) end
7 8 9 10 11 12 13 14 15 16 17 18
routh = routh_t ( m ) // T h i s F u n c t i o n g e n e r a t e s t h e Routh table disp ( routh , r o u t h s t a b u l a t i o n= ) c =0; for i =1: n if ( routh (i ,1) <0) c = c +1; end end if (c >=1) printf ( s y s t e m i s u n s t a b l e ) else printf ( s y s t e m i s s t a b l e ) end
Scilab code Exa 6.4 rst element in any row of rouths tabulation is z
1 2 3 4 5 6 7 8
// f i r s t e l e m e n t i n any row o f r o u t h s t a b u l a t i o n i s zero s = %s m = s ^4+ s ^3+2* s ^2+2* s +3 r = coeff ( m ) ; // E x t r a c t s t h e c o e f f i c i e n t o f t h e polynomial n = length ( r ) ; routh = routh_t ( m ) disp ( routh , r o u t h= ) printf ( s i n c e t h e r e a r e two s i g n c h a n g e s i n t h e rouths tabulation , sys i s uns ta ble )
Scilab code Exa 6.5 elements in any row of rouths tabulations are all // e l e m e n t s i n one row o f r o u t h s t a b u l a t i o n s a r e a l l zero 2 s = %s ;
1
39
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
m = s ^5+4* s ^4+8* s ^3+8* s ^2+7* s +4; disp ( m ) r = coeff ( m ) n = length ( r ) routh = routh_t ( m ) disp ( routh , r o u t h s t a b u l a t i o n s= ) c =0; for i =1: n if ( routh (i ,1) <0) c = c +1; end end if (c >=1) printf ( s y s t e m i s u n s t a b l e ) else printf ( s y s t e m i s m a r g i n a l l y s t a b l e ) end
// d e t e r m i n i n g c r i t i c a l v a l u e o f K s = %s syms K m = s ^3+3408.3* s ^2+1204000* s +1.5*10^7* K cof_a_0 = coeffs (m , s ,0) ; cof_a_1 = coeffs (m , s ,1) ; cof_a_2 = coeffs (m , s ,2) ; cof_a_3 = coeffs (m , s ,3) ; r =[ cof_a_0 cof_a_1 cof_a_2 cof_a_3 ] n = length ( r ) ; routh =[ r ([4 ,2]) ; r ([3 ,1]) ]; routh =[ routh ; - det ( routh ) / routh (2 ,1) ,0]; t = routh (2:3 ,1:2) ; // e x t r a c t i n g t h e s q u a r e sub b l o c k of routh matrix 40
16 routh =[ routh ; - det ( t ) / t (2 ,1) ,0] 17 disp ( routh , r o u t h s t a b u l a t i o n= ) 18 routh (3 ,1) =0 // For m a r g i n a l y s t a b l e s y s t e m 19 sys = syslin ( c ,1.5*10^7/( s ^3+3408.3* s ^2+1204000* s ) ) 20 k = kpure ( sys ) 21 disp (k , K( m a r g i n a l )= ) 22 disp ( =0 , routh (2 ,1) *( s ^2) +1.5*10^7* k , a u x i l l a r y
// d e t e r m i n i n g c r i t i c a l v a l u e o f K s = %s syms K m = s ^3+3* K * s ^2+( K +2) * s +4 cof_a_0 = coeffs (m , s ,0) ; cof_a_1 = coeffs (m , s ,1) ; cof_a_2 = coeffs (m , s ,2) ; cof_a_3 = coeffs (m , s ,3) ; r =[ cof_a_0 cof_a_1 cof_a_2 cof_a_3 ] n = length ( r ) ; routh =[ r ([4 ,2]) ; r ([3 ,1]) ]; routh =[ routh ; - det ( routh ) / routh (2 ,1) ,0]; t = routh (2:3 ,1:2) ; // e x t r a c t i n g t h e s q u a r e sub b l o c k of routh matrix routh =[ routh ; - det ( t ) / t (2 ,1) ,0] disp ( routh , r o u t h s t a b u l a t i o n= ) routh (3 ,1) =0 // For m a r g i n a l y s t a b l e s y s t e m sys = syslin ( c ,s *(3* s +1) /( s ^3+2* s +4) ) k = kpure ( sys ) 41
21
disp (k , K( m a r g i n a l )= )
a t z=1 )
// b i l i n e a r t r a n s f o r m a t i o n method r = %s // p=z 3 + 5 . 9 4 z 2 + 7 . 7 z 0.368 // s u b s t i t u t i n g z =(1+ r ) /(1 r ) we g e t m =3.128* r ^3 -11.47* r ^2+2.344* r +14.27 x = coeff ( m ) n = length ( x ) routh = routh_t ( m ) disp ( routh , r o u t h s t a b u l a t i o n s ) c =0; for i =1: n 42
12 13 14 15 16 17 18 19
if ( routh (i ,1) <0) then c = c +1 end end if (c >=1) then printf ( s y s t e m i s u n s t a b l e ) else printf ( s y s t e m i s s t a b l e ) end
// b i l i n e a r t r a n s f o r m a t i o n method s = %s syms K // p=z 3+ z 2+ z+K // s u b s t i t u t i n g z =(1+ r ) /(1 r ) we g e t m =(1 - K ) * s ^3+(1+3* K ) * s ^2+3*(1 - K ) * s +3+ K cof_a_0 = coeffs (m , s ,0) ; cof_a_1 = coeffs (m , s ,1) ; cof_a_2 = coeffs (m , s ,2) ; cof_a_3 = coeffs (m , s ,3) ; r =[ cof_a_0 cof_a_1 cof_a_2 cof_a_3 ]
n = length ( r ) ; routh =[ r ([4 ,2]) ; r ([3 ,1]) ]; routh =[ routh ; - det ( routh ) / routh (2 ,1) ,0]; t = routh (2:3 ,1:2) ; // e x t r a c t i n g t h e s q u a r e sub b l o c k of routh matrix 18 routh =[ routh ; - det ( t ) / t (2 ,1) ,0] 19 disp ( routh , r o u t h s t a b u l a t i o n= )
43
Scilab code Exa 7.2 steady state errors from open loop tf // s t e a d y s t a t e e r r o r s from open l o o p t r a n s f e r function 2 s = %s ; 3 // t y p e 1 s y s t e m 4 G = syslin ( c ,( s +3.15) /( s *( s +1.5) *( s +0.5) ) ) //K=1
1
44
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
disp (G , G( s )= ) H =1; y=G*H; disp (y , G( s )H( s )= ) syms s ; Kv = limit ( s *y ,s ,0) ; //Kv= v e l o c i t y e r r o r c o e f f i c i e n t Ess =1/ Kv // R e f e r i n g t h e t a b l e 7 . 1 g i v e n i n t h e book , For t y p e 1 s y s t e m Kp=%inf , E s s=0 & Ka=0 , E s s=% i n f printf ( For t y p e 1 s y s t e m \ n s t e p i n p u t Kp= i n f E s s=0 \ n \ n p a r a b o l i c i n p u t Ka=0 E s s= i n f \ n ) disp ( Kv , ramp i n p u t Kv= ) disp ( Ess , E s s= ) // t y p e 2 s y s t e m p = poly ([1] , s , c o e f f ) ; q = poly ([0 0 12 1] , s , c o e f f ) ; G = p / q ; //K=1 disp (G , G( s )= ) H =1; y=G*H; disp (y , G( s )H( s )= ) Ka = limit ( s ^2* y ,s ,0) ; //Ka= p a r a b o l i c e r r o r coefficient Ess =1/ Ka // R e f e r i n g t h e t a b l e 7 . 1 g i v e n i n t h e book , For t y p e 2 s y s t e m Kp=%inf , E s s=0 & Kv=i n f , E s s=0 printf ( For t y p e 2 s y s t e m \ n s t e p i n p u t Kp= i n f E s s=0 \ n ramp i n p u t Kv= i n f E s s=0 \ n ) disp ( Ka , p a r a b o l i c i n p u t Ka= ) disp ( Ess , E s s= ) // t y p e 2 s y s t e m p = poly ([5 5] , s , c o e f f ) ; q = poly ([0 0 60 17 1] , s , c o e f f ) ; G = p / q ; //K=1 disp (G , G( s )= ) H =1; y=G*H; disp (y , G( s )H( s )= ) 45
error
coefficient
39 Ess =1/ Ka 40 // R e f e r i n g t h e t a b l e
7 . 1 g i v e n i n t h e book , For t y p e 2 s y s t e m Kp=%inf , E s s=0 & Kv=i n f , E s s=0 41 printf ( For t y p e 2 s y s t e m \ n s t e p i n p u t Kp= i n f E s s=0 \ n ramp i n p u t Kv= i n f E s s=0 \ n ) 42 disp ( Ka , p a r a b o l i c i n p u t Ka= ) 43 disp ( Ess , E s s= )
Scilab code Exa 7.3 steady state errors from closed loop tf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// s t e a d y s t a t e e r r o r s from c l o s e d l o o p t r a n s f e r functions s = %s p = poly ([3.15 1 0] , s , c o e f f ) ; //K=1 q = poly ([3.15 1.75 2 1] , s , c o e f f ) ; M=p/q disp (M , M( s )= ) H =1; R =1; b = coeff ( p ) a = coeff ( q ) // s t e p i n p u t if ( a (1 ,1) == b (1 ,1) ) then printf ( f o r u n i t s t e p i n p u t E s s=0 ) else Ess =1/ H *(1 -( b (1 ,1) * H / a (1 ,1) ) ) * R disp ( Ess , f o r u n i t s t e p i n p u t E s s= ) end // ramp i n p u t c =0 for i =1:2 46
// p a r a b o l i c i n p u t c =0 for i =1:3 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==3) printf ( f o r u n i t p a r a b o l i c i n p u t E s s=0 ) else if ( c ==2) then Ess =( a (1 ,3) -b (1 ,3) * H ) / a (1 ,1) * H disp ( Ess , f o r u n i t p a r a b o l i c i n p u t E s s= ) 48 else printf ( f o r u n i t p a r a b o l i c i n p u t E s s= i n f ) 49 end 50 end
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==2) printf ( f o r u n i t ramp i n p u t E s s=0 ) else if ( c ==1) then Ess =( a (1 ,2) -b (1 ,2) * H ) / a (1 ,1) * H disp ( Ess , f o r u n i t ramp i n p u t E s s= ) else printf ( f o r u n i t ramp i n p u t E s s= i n f ) end end
Scilab code Exa 7.4 steady state errors from closed loop tf
1
// s t e a d y s t a t e e r r o r s from c l o s e d l o o p t r a n s f e r functions 47
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
s = %s p = poly ([5 5 0] , s , c o e f f ) ; q = poly ([5 5 60 17 1] , s , c o e f f ) ; M=p/q disp (M , M( s )= ) H =1; R =1; b = coeff ( p ) a = coeff ( q ) // s t e p i n p u t if ( a (1 ,1) == b (1 ,1) ) then printf ( f o r u n i t s t e p i n p u t E s s=0 \ n ) else Ess =1/ H *(1 -( b (1 ,1) * H / a (1 ,1) ) ) * R disp ( Ess , f o r u n i t s t e p i n p u t E s s= ) end
// ramp i n p u t c =0 for i =1:2 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==2) printf ( f o r u n i t ramp i n p u t E s s=0 \ n ) else if ( c ==1) then Ess =( a (1 ,2) -b (1 ,2) * H ) / a (1 ,1) * H disp ( Ess , f o r u n i t ramp i n p u t E s s= ) else printf ( f o r u n i t ramp i n p u t E s s= i n f \ n ) 33 end 34 end
35 36 // p a r a b o l i c 37 c =0 38 for i =1:3
input
48
39 if ( a (1 , i ) -b (1 , i ) * H ==0) then 40 c = c +1 41 end 42 end 43 if ( c ==3) 44 printf ( f o r u n i t p a r a b o l i c i n p u t E s s=0 \ n ) 45 else if ( c ==2) then 46 Ess =( a (1 ,3) -b (1 ,3) * H ) / a (1 ,1) * H 47 disp ( Ess , f o r u n i t p a r a b o l i c i n p u t E s s= 48 49 50
Scilab code Exa 7.5 steady state errors from closed loop tf
1
2 3 4 5 6 7 8 9 10 11 12 // s t e p i n p u t 13 if ( a (1 ,1) == b (1 ,1) ) then 14 printf ( f o r u n i t s t e p i n p u t E s s=0 \ n ) 15 else 16 Ess =1/ H *(1 -( b (1 ,1) * H / a (1 ,1) ) ) * R 17 disp ( Ess , f o r u n i t s t e p i n p u t E s s= )
// s t e a d y s t a t e e r r o r s from c l o s e d l o o p t r a n s f e r functions s = %s p = poly ([5 1 0] , s , c o e f f ) ; q = poly ([5 5 60 17 1] , s , c o e f f ) ; M=p/q disp (M , M( s )= ) H =1; R =1; b = coeff ( p ) a = coeff ( q )
49
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
end
// ramp i n p u t c =0 for i =1:2 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==2) printf ( f o r u n i t ramp i n p u t E s s=0 \ n ) else if ( c ==1) then Ess =( a (1 ,2) -b (1 ,2) * H ) / a (1 ,1) * H disp ( Ess , f o r u n i t ramp i n p u t E s s= ) else printf ( f o r u n i t ramp i n p u t E s s= i n f \ n ) 33 end 34 end
// p a r a b o l i c i n p u t c =0 for i =1:3 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==3) printf ( f o r u n i t p a r a b o l i c i n p u t E s s=0 \ n ) else if ( c ==2) then Ess =( a (1 ,3) -b (1 ,3) * H ) / a (1 ,1) * H disp ( Ess , f o r u n i t p a r a b o l i c i n p u t E s s= ) 48 else printf ( f o r u n i t p a r a b o l i c i n p u t E s s= i n f \n) 49 end 50 end
35 36 37 38 39 40 41 42 43 44 45 46 47
50
Scilab code Exa 7.6 steady state errors from closed loop tf
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
// s t e a d y s t a t e e r r o r s from c l o s e d l o o p t r a n s f e r functions s = %s p = poly ([5 1 0] , s , c o e f f ) ; q = poly ([10 10 60 17 1] , s , c o e f f ) ; M=p/q disp (M , M( s )= ) H =2; R =1; b = coeff ( p ) a = coeff ( q ) // s t e p i n p u t if ( a (1 ,1) == b (1 ,1) ) then printf ( f o r s t e p i n p u t E s s=0 \ n ) else Ess =1/ H *(1 -( b (1 ,1) * H / a (1 ,1) ) ) * R disp ( Ess , f o r s t e p i n p u t E s s= ) end // ramp i n p u t c =0 for i =1:2 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==2) printf ( f o r ramp i n p u t E s s=0 \ n ) else if ( c ==1) then Ess =( a (1 ,2) -b (1 ,2) * H ) / a (1 ,1) * H disp ( Ess , f o r ramp i n p u t E s s= ) 51
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
// p a r a b o l i c i n p u t c =0 for i =1:3 if ( a (1 , i ) -b (1 , i ) * H ==0) then c = c +1 end end if ( c ==3) printf ( f o r p a r a b o l i c i n p u t E s s=0 \ n ) else if ( c ==2) then Ess =( a (1 ,3) -b (1 ,3) * H ) / a (1 ,1) * H disp ( Ess , f o r p a r a b o l i c i n p u t E s s= ) else printf ( f o r p a r a b o l i c i n p u t E s s= i n f \ n ) 49 end 50 end
52
i s 3 as
e q u a t i o n i s o f 3 rd o r d e r ) 53
54
55
56
is
57
// r o o t l o c u s s = %s sys = syslin ( c ,( s +1) /( s *( s +4) *( s ^2+2* s +2) ) ) clf evans ( sys ) n =4; disp (n , no o f p o l e s= ) m =1; disp (m , no o f p o l e s= ) 58
10 // a n g l e o f a s y m p t o t e s 11 printf ( a n g l e o f a s y m p t o t e s o f RL ) 12 for i =0:( n -m -1) 13 O =((2* i ) +1) /( n - m ) *180 14 disp (O , q= ) 15 end 16 printf ( a n g l e o f a s y m p t o t e s o f CRL ) 17 for i =0:( n -m -1) 18 O =(2* i ) /( n - m ) *180 19 disp (O , q= ) 20 end 21 // c e n t r o i d 22 printf ( C e n t r o i d =(( sum o f a l l r e a l p a r t o f
poles of r e a l p a r t o f z e r o s o f G( s )H
loci
on t h e r e a l a x i s a r e n o t a f f e c t e d by c o m p l e x p o l e s and z e r o e s o f G( s )H( s ) )
60
axis i s occupied
by RL and CRL )
Scilab code Exa 8.10 intersection of root loci with real axis
1
// i n t e r s e c t i o n o f r o o t l o c i w i t h r e a l a x i s 61
s = %s sys = syslin ( c ,1/( s *( s +3) *( s ^2+2* s +2) ) ) clf evans ( sys ) K = kpure ( sys ) disp (K , v a l u e o f K where RL c r o s s e s jw a x i s= ) p = poly ([ K 6 8 5 1] , s , c o e f f ) x = roots ( p ) x1 = clean ( x (1 ,1) ) x2 = clean ( x (2 ,1) ) disp ( x2 , x1 , c r o s s o v e r p o i n t s on jw a x i s= )
62
// breakaway p o i n t s s = %s sys = syslin ( c ,( s +4) /( s *( s +2) ) ) evans ( sys ) syms s d = derivat ( sys ) n = numer ( d ) a = roots ( n ) // a=breakaway p o i n t s disp (a , breakaway p o i n t s= ) for i =1:2 K = - a (i ,1) *( a (i ,1) +2) /( a (i ,1) +4) disp ( a (i ,1) , s= ) disp (K , K= ) end printf ( i f K i s p o s i t i v e breakaway p o i n t l i e s on RL o r e l s e on CRL )
// breakaway p o i n t s s = %s sys = syslin ( c ,( s +2) /( s ^2+2* s +2) ) evans ( sys ) syms s d = derivat ( sys ) n = numer ( d ) a = roots ( n ) // a=breakaway p o i n t s disp (a , breakaway p o i n t s= ) for i =1:2 K = -( a (i ,1) ^2+2* a (i ,1) +2) /( a (i ,1) +2) disp ( a (i ,1) , s= ) 63
64
l i e s on RL
o r e l s e on CRL )
65
syms s d = derivat ( sys ) n = numer ( d ) a = roots ( n ) // a=breakaway p o i n t s disp (a , breakaway p o i n t s= ) for i =1:3 K = - a (i ,1) *( a (i ,1) +4) *( a (i ,1) ^2+4* a (i ,1) +20) disp ( a (i ,1) , s= ) disp (K , K= ) end printf ( i f K i s p o s i t i v e breakaway p o i n t l i e s on RL o r e l s e on CRL )
66
// breakaway p o i n t s s = %s sys = syslin ( c ,1/( s *( s ^2+2* s +2) ) ) evans ( sys ) syms s d = derivat ( sys ) n = numer ( d ) a = roots ( n ) // a=breakaway p o i n t s disp (a , breakaway p o i n t s= ) for i =1:2 K = - a (i ,1) ^2+2* a (i ,1) +2 disp ( a (i ,1) , s= ) disp (K , K= ) end printf ( i f K i s c o m p l e x t h e n p o i n t i s n o t a b r e a k away p o i n t )
is
i n f i n i t e )
67
68
69
70
7 8 9 10 11
printf ( K=AB/C \ n A and B a r e l e n t h s o f v e c t o r s drawn from p o l e s o f s y s \ n C i s l e n t h s o f v e c t o r drawn from z e r o o f s y s ) A = sqrt (( -1) ^2+1^2) B = sqrt (( -1) ^2+( -1) ^2) C = -2 K=A*B/C disp (K , v a l u e o f K a t s =0 i s )
// p r o p e r t i e s o f r o o t l o c i s = %s sys = syslin ( c ,( s +3) /( s *( s +5) *( s +6) *( s ^2+2* s +2) ) ) d = denom ( sys ) n = numer ( sys ) p = roots ( d ) z = roots ( n ) disp (p , p o l e s o f s y s= ) disp (z , z e r o e s o f s y s= ) n = length ( p ) m = length ( z ) disp (n , no o f p o l e s= ) disp (m , no o f z e r o e s= ) if (n > m ) then disp (n , no o f b r a n c h e s o f RL= ) else disp (m , no o f b r a n c h e s o f CRL= ) end printf ( t h e r o o t l o c i a r e s y m m e t r i c a l w i t h r e s p e c t to the r e a l a x i s of the plane )
t h e r o o t l o c i t o w a r d s t h e RHP )
72
73
Figure 8.17: eect of addition of zeroes to system Scilab code Exa 8.19 eect of addition of zeroes to system
1 // e f f e c t o f a d d i t i o n o f z e r o e s t o s y s 2 s = %s 3 sys = syslin ( c ,1/( s *( s +1) ) ) // a=1 4 evans ( sys ) 5 sys1 = syslin ( c ,( s +2) /( s *( s +1) ) ) // b=2 6 // e v a n s ( s y s 1 ) 7 printf ( a d d i n g a LHP z e r o t o s y s h a s e f f e c t
74
75
moves t o w a r d s jw a x i s )
Scilab code Exa 8.21 eect of moving poles awat from jw axis
1 // e f f e c t o f moving p o l e away from jw a x i s 2 s = %s 3 sys1 = syslin ( c ,( s +2) /( s *( s ^2+2* s +1) ) ) // a=1 4 evans ( sys1 ) 5 sys2 = syslin ( c ,( s +1) /( s *( s ^2+2* s +1.12) ) ) // a =1.12 6 evans ( sys2 ) 7 sys3 = syslin ( c ,( s +1) /( s *( s ^2+2* s +1.185) ) ) // a 8
77
78
sys4 = syslin ( c ,( s +1) /( s *( s ^2+2* s +3) ) ) // a=3 evans ( sys4 ) printf ( a s p o l e i s moved away from jw a x i s RL a l s o moves away from jw a x i s )
79
80
81
82
83
// s t a b i l i t y o f non minimum p h a s e l o o p transfer function 2 s = %s ; 3 sys = syslin ( c ,( s ^2 - s +1) / s *( s ^2 -6* s +5) ) 4 nyquist ( sys ) 84
7 8 9 10 11 12
show_margins ( sys , n y q u i s t ) printf ( Z=0 h e n c e s y s i s c l o s e d l o o p s t a b l e but a s i t i s a non minimum p h a s e l o o p f u n c t i o n i t s h o u l d s a t i s f y angle c r i t e r i o n ) Z =0 // no o f z e r o e s o f 1+G( s )H( s ) i n RHP P =2 // no o f p o l e s i n RHP Pw =1 // no o f p o l e s on jw a x i s i n c l u d i n g o r i g i n theta =( Z -P -0.5* Pw ) *180 disp ( theta , t h e t a= ) printf ( t h e t a from n y q u i s t p l o t = 90 \ n h e n c e system i s unstabe )
85
// s t a b i l i t y o f minimum p h a s e l o o p t r a n s f e r f u n c t i o n s = %s ; sys = syslin ( c ,1/( s *( s +2) *( s +10) ) ) nyquist ( sys ) show_margins ( sys , n y q u i s t ) Z =0 // no o f z e r o e s o f 1+G( s )H( s ) i n RHP P =0 // no o f p o l e s i n RHP Pw =1 // no o f p o l e s on jw a x i s i n c l u d i n g o r i g i n theta =( Z -P -0.5* Pw ) *180 disp ( theta , t h e t a= ) printf ( t h e t a from n y q u i s t p l o t = 90 \ n h e n c e system i s stabe )
// s t a b i l i t y o f non minimum p h a s e l o o p transfer function s = %s ; sys = syslin ( c ,(s -1) / s *( s +1) ) nyquist ( sys ) show_margins ( sys , n y q u i s t ) P =0 // no o f p o l e s i n RHP Pw =1 // no o f p o l e s on jw a x i s i n c l u d i n g o r i g i n theta =90 // a s s e e n from n y q u i s t p l o t Z =( theta /180) +0.5* Pw + P disp (Z , Z= ) printf ( Z i s n o t e q u a l t o 0 . \ n h e n c e s y s t e m i s unstabe )
86
87
88
7 8 9 10 11 12
// s t a b i l i t y o f non minimum p h a s e l o o p transfer function s = %s ; sys = syslin ( c ,10*( s +2) /( s ^3+3* s ^2+10) ) nyquist ( sys ) show_margins ( sys , n y q u i s t ) printf ( Z=0 h e n c e s y s i s c l o s e d l o o p s t a b l e but a s i t i s a non minimum p h a s e l o o p f u n c t i o n i t s h o u l d s a t i s f y angle c r i t e r i o n ) Z =0 // no o f z e r o e s o f 1+G( s )H( s ) i n RHP P =2 // no o f p o l e s i n RHP Pw =0 // no o f p o l e s on jw a x i s i n c l u d i n g o r i g i n theta =( Z -P -0.5* Pw ) *180 disp ( theta , t h e t a f o r s t a b i l i t y = ) printf ( t h e t a from n y q u i s t p l o t = 360 \ n h e n c e system i s stabe )
// s t a b i l i t y o f non minimum p h a s e l o o p transfer function s = %s ; sys = syslin ( c ,1/( s +2) *( s ^2+4) ) nyquist ( sys ) show_margins ( sys , n y q u i s t ) Z =0 // no o f z e r o e s o f 1+G( s )H( s ) i n RHP( f o r s y s t o be stable ) P =0 // no o f p o l e s i n RHP 89
90
system i s unstabe )
poles
d e c r e a s e s s t a b i l i t y )
=2 nyquist ( sys1 ) show_margins ( sys1 , n y q u i s t ) sys2 = syslin ( c ,(3* s +1) /( s *( s +1) *(2* s +1) ) ) //Td=3 // n y q u i s t ( s y s 2 ) 91
92
93
// m u l t i p l e l o o p s y s t e m s 94
95
96
2 s = %s 3 innerloop = syslin ( c ,6/ s *( s +1) *( s +2) ) 4 nyquist ( innerloop ) 5 show_margins ( innerloop , n y q u i s t ) 6 printf ( n y q u i s t p l o t i n t e r s e c t s jw a x i s a t 1 s o 7 8 9 10 11 12 13 14 15
i n n e r l o o p i s marginally s t a b l e ) outerloop = syslin ( c ,100*( s +0.1) /( s +10) *( s ^3+3* s ^2+2* s +6) ) // n y q u i s t ( o u t e r l o o p ) show_margins ( outerloop , n y q u i s t ) P =0 // no o f p o l e s on RHP Pw =2 // no o f p o l e s on jw a x i s theta = -(Z -P -0.5* Pw ) *180 Z =0 // f o r o u t e r l o o p t o be s t a b l e disp ( theta , t h e t a f o r s t a b i l i t y = ) printf ( t h e t a a s s e e n from n y q u i s t p l o t i s same a s t h a t r e q u i r e d f o r s t a b i l i t y \n hence o u t e r l o o p i s s t a b l e )
// g a i n m a r g i n and p h a s e m a r g i n s = %s ; sys = syslin ( c ,(2500) /( s *( s +5) *( s +50) ) ) nyquist ( sys ) show_margins ( sys , n y q u i s t ) gm = g_margin ( sys ) pm = p_margin ( sys ) disp ( gm , g a i n m a r g i n= ) disp ( pm , p h a s e m a r g i n= )
97
98
99
// bode p l o t s = %s ; sys = syslin ( c ,(2500) /( s *( s +5) *( s +50) ) ) bode ( sys ) show_margins ( sys , bode ) gm = g_margin ( sys ) pm = p_margin ( sys ) disp ( gm , g a i n m a r g i n= ) disp ( pm , p h a s e m a r g i n= ) if ( gm <=0 | pm <=0) printf ( s y s t e m i s u n s t a b l e ) else printf ( s y s t e m i s s t a b l e ) end
+200) ) ) //K=1 bode ( sys ) show_margins ( sys , bode ) gm = g_margin ( sys ) pm = p_margin ( sys ) disp ( gm , g a i n m a r g i n= ) disp ( pm , p h a s e m a r g i n= ) if ( gm <=0 | pm <=0) 100
101
11 12 13 14
102