Professional Documents
Culture Documents
Created by Anuradha Singhania 4th Year Student B. Tech. (Elec. & Commun. ) Sri Mata Vaishno Devi University, Jammu College Teacher Prof. Amit Kumar Garg Sri Mata Vaishno Devi University, Jammu Reviewer Prof. Madhu Belur, IIT Bombay 29 June 2010
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 www.scilab.in
1 Funded
Book Details
Authors: Smarajit Ghosh Title: Control Systems Publisher: Pearson Education Edition: 2nd Year: 2009 Place: New Delhi ISBN: 978-81-317-0828-6
Contents
List of Scilab Code 2 Laplace Transform and Matrix Algebra 2.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Transfer Function 3.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Control system Components 4.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Control system Components 6.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Time Domain Analysis of Control Systems 8.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Feedback Characteristics of control Systems 9.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Stability 10.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Root Locus Method 11.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Frequency Domain Analysis 12.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 11 11 14 14 17 17 21 21 29 29 44 44 54 54 64 64 90 90
95 95
15 Nyquist Plot 103 15.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 17 State Variable Approach 112 17.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 18 Digital Control Systems 122 18.1 Scilab Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.03 6.04 6.05 6.06 6.07 6.08 6.09 6.10 6.11 6.12 6.13 6.14 6.15 8.02 8.03-01 8.03-02 8.03-03 8.04 8.05 8.06 8.07 8.08 8.09 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.19 8.20 8.23-01 8.23-02 8.23-03 8.23-04 8.24
6.03.sci . . 6.04.sci . . 6.05.sci . . 6.06.sci . . 6.07.sci . . 6.08.sci . . 6.09.sci . . 6.10.sci . . 6.11.sci . . 6.12.sci . . 6.13.sci . . 6.14.sci . . 6.15.sci . . 8.02.sci . . 8.03.01.sci 8.03.02.sci 8.03.03.sci 8.04.sci . . 8.05.sci . . 8.06.sci . . 8.07.sci . . 8.08.sci . . 8.09.sci . . 8.10.sci . . 8.11.sci . . 8.12.sci . . 8.13.sci . . 8.14.sci . . 8.15.sci . . 8.16.sci . . 8.17.sci . . 8.19.sci . . 8.20.sci . . 8.23.01.sci 8.23.02.sci 8.23.03.sci 8.23.04.sci 8.24.sci . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22 23 23 23 23 24 24 25 25 26 26 27 27 29 29 30 30 31 31 32 32 33 34 34 35 35 36 36 37 37 38 39 39 40 40 41 41 42
8.32 9.01 9.02 9.03 9.04 9.05 9.06 9.07 9.08 9.09 9.10 9.11 10.02-01 10.02-02 10.02-03 10.03 10.04 10.05-01 10.05-02 10.06 10.07 10.08 10.09 10.10 10.11 10.12 10.13 10.14 10.15 10.16 11.01 11.02 11.03 11.04 11.05 11.06 11.08 11.09
8.32.sci . . . 9.01.sci . . . 9.02.sci . . . 9.03.sci . . . 9.04.sci . . . 9.05.sci . . . 9.06.sci . . . 9.07.sci . . . 9.08.sci . . . 9.09.sci . . . 9.10.sci . . . 9.11.sci . . . 10.02.01.sci 10.02.02.sci 10.02.03.sci 10.03.sci . . 10.04.sci . . 10.05.01.sci 10.05.02.sci 10.06.sci . . 10.07.sci . . 10.08.sci . . 10.09.sci . . 10.10.sci . . 10.11.sci . . 10.12.sci . . 10.13.sci . . 10.14.sci . . 10.15.sci . . 10.16.sci . . 11.01.sci . . 11.02.sci . . 11.03.sci . . 11.04.sci . . 11.05.sci . . 11.06.sci . . 11.08.sci . . 11.09.sci . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42 44 45 45 46 47 47 48 49 50 51 52 54 54 55 55 56 56 57 57 58 59 59 60 61 61 62 62 63 63 64 64 64 65 67 69 70 71
11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.19 11.20 11.21 11.22 11.23 11.25 11.26 11.27 11.28 12.01 12.02 12.03 12.04 12.05 13.01 13.02 13.03 13.04 13.05 13.06 15.01 15.02 15.03 15.04 15.05 15.06 15.07 15.08 17.03 17.04
11.10.sci 11.11.sci 11.12.sci 11.13.sci 11.14.sci 11.15.sci 11.16.sci 11.17.sci 11.19.sci 11.20.sci 11.21.sci 11.22.sci 11.23.sci 11.25.sci 11.26.sci 11.27.sci 11.28.sci 12.01.sci 12.02.sci 12.03.sci 12.04.sci 12.05.sci 13.01.sci 13.02.sci 13.03.sci 13.04.sci 13.05.sci 13.06.sci 15.01.sci 15.02.sci 15.03.sci 15.04.sci 15.05.sci 15.06.sci 15.07.sci 15.08.sci 17.03.sci 17.04.sci
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71 73 73 74 74 74 75 76 78 79 79 80 81 82 83 84 87 90 91 91 92 92 95 95 97 98 98 100 103 103 104 105 106 107 108 109 112 112
17.06 17.07 17.08 17.09 17.10 17.11 17.12 17.13 17.14 17.16 17.17 17.18 17.19 17.20 17.21 17.22 17.23 F3 18.01 18.08
17.06.sci . . 17.07.sci . . 17.08.sci . . 17.09.sci . . 17.10.sci . . 17.11.sci . . 17.12.sci . . 17.13.sci . . 17.14.sci . . 17.16.sci . . 17.17.sci . . 17.18.sci . . 17.19.sci . . 17.20.sci . . 17.21.sci . . 17.22.sci . . 17.23.sci . . ztransfer.sce 18.01.01.sci 18.08.01.sci
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
112 113 113 113 113 114 114 115 116 116 117 117 117 118 119 119 120 122 122 122
List of Figures
11.1 Output 11.2 Output 11.3 Output 11.4 Output 11.5 Output 11.6 Output 11.7 Output 11.8 Output 11.9 Output 11.10Output 11.11Output 11.12Output 11.13Output 11.14Output 11.15Output 11.16Output 11.17Output 11.18Output 11.19Output 11.20Output 11.21Output 11.22Output 13.1 13.2 13.3 13.4 13.5 13.6 Output Output Output Output Output Output Graph of S 11.01 Graph of S 11.02 Graph of S 11.03 of S 11.04 . . . . of S 11.05 . . . . of S 11.06 . . . . of S 11.08 . . . . of S 11.09 . . . . of S 11.13 . . . . of S 11.14 . . . . of S 11.15 . . . . of S 11.16 . . . . of S 11.17 . . . . of S 11.19 . . . . of S 11.20 . . . . of S 11.21 . . . . of S 11.22 . . . . of S 11.23 . . . . of S 11.25 . . . . of S 11.26 . . . . of S 11.27 . . . . of S 11.28 . . . . of of of of of of S S S S S S 13.01 13.02 13.03 13.04 13.05 13.06 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 66 67 68 69 70 71 72 75 76 77 78 79 80 81 82 83 84 85 86 88 89 96 97 99 100 101 102
of of of of of of of of
S S S S S S S S
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
10
2.1
Scilab Code
1 2 3
1 2 3
p=poly ( [ 9 1 ] , s , c o e f f ) q=poly ( [ 3 7 1 ] , s , c o e f f ) f=p/q ; disp ( f , F( s )= ) x=s f ; y=l i m i t ( x , s , 0 ) ; / / f i n a l v a l u e disp ( y , f ( i n f )= ) z=l i m i t ( x , s , %inf ) ; / / i n i t i a l disp ( z , f ( 0 )= ) Example 2.04 2.04.sci
theorem
value
theorem
1 2 3 4
s=%s syms t ; disp ( ( s +3) / ( ( s +1) ( s +2) ( s +4) ) , F( s )= ) [A]= pfss ( ( s +3) / ( ( s +1) ( s +2) ( s +4) ) ) / / p a r t i a l
of F( s )
fraction
5 6 7 8 9
F1= i l a p l a c e (A( 1 ) , s , t ) F2= i l a p l a c e (A( 2 ) , s , t ) F3= i l a p l a c e (A( 3 ) , s , t ) F=F1+F2+F3 ; disp (F , f ( t )= ) Example 2.05-01 2.05.01.sci
1 2 3
1 2 3
1 2 3 4 5 6 7 8 9 10 11 12
p=poly ( [ 0 . 3 8 ] , s , c o e f f ) ; q=poly ( [ 0 0 . 5 4 3 2 . 4 8 1 ] , s , c o e f f ) ; F=p/q ; syms s ; x=s F ; y=l i m i t ( x , s , 0 ) ; / / y=db l ( y ) ; disp ( y , f ( i n f )= ) z=l i m i t ( x , s , %inf ) / / z=db l ( z ) ; disp ( z , f ( 0 )= ) Example 2.13 2.13.sci
final
value
theorem
//
i n i t i a l
value
theorem
1 2 3 4 5 6 7
13
3.1
Scilab Code
1 2 3 4 5 6 7 8
syms t s ; disp (%e(3 t ) , g ( t )= ) ; y1=l a p l a c e ( %e(3 t ) , t , s ) ; disp ( y1 , G( s )= ) disp (%e(4 t ) , r ( t )= ) ; y2=l a p l a c e ( %e(4 t ) , t , s ) ; disp ( y2 , R( s )= ) disp ( y1y2 , G( s )R( s )= ) Example 3.04 3.04.sci 14
1 2 3
s=%s ; H=s y s l i n ( c , ( 4 ( s +2) ( ( s +2.5) 3) ) / ( ( s +6) ( ( s +4) 2 ) ) ) ; plzr (H) Example 3.15 3.15.sci
1 2 3
1 2
// Given
step
Response
of
4 5
6 7
printf ( Derivative of step response g i v e s impulse r e s p o n s e \n ) y=d i f f ( x , t ) ; // D e r i v a t i v e of step response p r i n t f ( L a p l a c e Transform o f Impulse Response g i v e s th e T r a n s f e r Function \n ) p=l a p l a c e ( y , t , s ) ; disp ( p , T r a n s f e r Function= ) Example 3.17 3.17.sci
2 3 4 5
p r i n t f ( Given : P o l e s a r e s=1,(2+ i ) ,(2 i ) ; z e r o s =3+i ,3 i , Gain f a c t o r ( k )=5 \n ) num=poly([3+%i,3%i ] , s , r o o t s ) ; den=poly([1,2+%i,2%i ] , s , r o o t s ) ; G=(5num) / den ; disp (G, G( s )= ) Example 3.18 3.18.sci
1 2 3
4 5 6 7
2 3 4 5 6 7 8 9 10 11 12 13 14
p r i n t f ( Given : P o l e s a r e s =3, Z e r o s a r e s =2, Gain F a c t o r ( k )=5 \n ) num=poly ( [ 2 ] , s , r o o t s ) ; den=poly ( [ 3 ] , s , r o o t s ) ; G=5num/ den ; disp (G, G( s )= ) disp ( Input i s Step Function ) syms t s ; R=l a p l a c e ( 1 , t , s ) ; disp (R, R( s )= ) p r i n t f ( C( s )=R( s )G( s ) \n ) C=RG; disp (C, C( s )= ) c=i l a p l a c e (C, s , t ) ; disp ( c , c ( t )= ) Example 3.23 3.23.sci
1 2 3 4 5 6 7 8 9
// p o l e
zero
plot
for
s=%s ; p=poly ( [ 2 3 1 ] , s , c o e f f ) q=poly ( [ 1 2 7 1 ] , s , c o e f f ) V=s y s l i n ( c , p , q ) plzr (V) syms s t ; v =i l a p l a c e ( (2+(3 s )+s 2) / ( s 2+(7 s ) +12) , s , t ) disp ( v , V( t ) = )
16
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
p r i n t f ( Given a ) E x c i t a t i o n v o l t a g e ( Ein )=2V \n b ) S e t t i n g Ratio ( a )= 0 . 4 \n ) Ein =2; disp ( Ein , Ein= ) a =0.4; disp ( a , a= ) Rt =103; disp ( Rt , Rt= ) Rl =5103; disp ( Rl , Rl= ) p r i n t f ( Eo = ( a Ein ) /(1+( a(1a ) Rt ) / Rl ) \n ) Eo = ( a Ein ) /(1+( a(1a ) Rt ) / Rl ) ; disp ( Eo , output v o l t a g e ( E0 )= ) p r i n t f ( e =(( a 2 ) (1a ) ) / ( ( a(1a ) ) +(Rl /Rt ) ) \n ) e =(( a 2) (1a ) ) / ( ( a(1a ) ) +(Rl /Rt ) ) ; disp ( e , l o a d i n g e r r o r= ) p r i n t f ( E=Ein e \n ) E=Ein e ; / / V o l t a g e e r r o r = E x c i t a t i o n v o l t a g e ( E i n )
Loading error ( e )
18
disp (E , V o l t a g e e r r o r= )
17
17 18 19 20 21 22 23 24 25 26 27
p r i n t f ( n=5 , H e l i c a l turn \n ) n=5; / / H e l i c a l t u r n disp ( n , n= ) p r i n t f ( N=9000 , Winding Turn \n ) N=9000; / / W i n d i n g T u r n disp (N, N= ) p r i n t f ( R=10000 , P o t e n t i o m e t e r R e s i s t a n c e \n ) R=10000; / / P o t e n t i o m e t e r R e s i s t a n c e disp (R, R= ) p r i n t f ( Ein=90 , Input v o l t a g e \n ) Ein =90; / / I n p u t v o l t a g e disp ( Ein , Ein= ) p r i n t f ( r =5050 , R e s i s t a n c e a t mid p o i n t \n ) r =5050; / / R e s i s t a n c e a t m i d p o i n t disp ( r , r= ) p r i n t f ( D=r 5000 , D e v i a t i o n from nominal a t midp o i n t \ n ) D=r 5000; / / D e v i a t i o n f r o m n o m i n a l a t m i d p o i n t disp (D, D= ) p r i n t f ( L=D/R100 , L i n e a r i t y \n ) L=D/R 1 0 0 ; / / L i n e a r i t y disp (L , L= ) p r i n t f ( R=Ein /N , R e s o l u t i o n \n ) R=Ein /N; / / R e s o l u t i o n disp (R, R= ) p r i n t f ( Kp=Ein /(2 p i n ) , P o t e n t i o m e t e r Constant \n ) Kp=Ein /(2 %pin ) ; / / P o t e n t i o m e t e r C o n s t a n t disp (Kp, Kp= ) Example 4.03 4.03.sci
2 3 4
p r i n t f ( s i n c e S2 i s t h e r e f e r a n c e s t a t o r winding , Es2= KVcos0 \n where Es2 & Er a r e rms v o l t a g e s \n ) k=1 Theta =60; d i s p ( Theta , Theta= ) 18
5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21 22 23 24
V=28; d i s p (V, V( a p p l i e d )= ) p r i n t f ( Es2=V cos ( Theta ) \n ) Es2=kV c o s ( Theta ( %pi /180) ) ; d i s p ( Es2 , Es2= ) p r i n t f ( Es1=kV cos ( Theta 120)\n ) Es1=kV c o s ( ( Theta 120) ( %pi /180) ) ; // Given Theta=60 in degrees d i s p ( Es1 , Es1= ) p r i n t f ( Es3=kV c o s ( Theta +120) \n ) Es3=kV c o s ( ( Theta +120) ( %pi /180) ) ; d i s p ( Es3 , Es3= ) p r i n t f ( Es31=s q r t ( 3 ) kEr s i n ( Theta ) ) Es31=sqrt ( 3 ) kV sin ( Theta ( %pi /180) ) ; disp ( Es31 , Es31 = ) p r i n t f ( Es12=sqrt ( 3 ) kEr sin ( ( Theta 120) ) Es12=s q r t ( 3 ) kV s i n ( ( Theta 120) ( %pi /180) ) ; d i s p ( Es12 , Es12= ) p r i n t f ( Es23=s q r t ( 3 ) kEr s i n ( ( Theta +120) ) Es23=s q r t ( 3 ) kV s i n ( ( Theta +120) ( %pi /180) ) ; d i s p ( Es23 , Es23= ) Example 4.04 4.04.sci
1 2 3 4 5 6 7 8 9
p r i n t f ( S e n s i t i v i t y =5v /1000rpm \n ) Vg=5; disp (Vg , Vg= ) p r i n t f ( w( i n r a d i a n s / s e c ) =(1000/60) 2 p i \n ) w=(1000/60) 2 %pi ; disp (w, w= ) p r i n t f ( Kt=Vg/w \n ) Kt=Vg/w; d i s p ( Kt , Gain c o n s t a n t ( Kt )= ) Example 4.05 4.05.sci
1 2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
disp ( t , Torque ( t )= ) Fm= 0 . 2 ; disp (Fm, C o e f f i c i e n t o f V i s c o u s f r i c t i o n (Fm)= ) N=4 I =0.2 F1=0.05 p r i n t f ( Wnl=t /Fm ) Wnl=t /Fm; disp (Wnl , No Load Speed (Wnl)= ) p r i n t f ( Fwt=I +(N2F1 ) \n ) Fwt=I +(N2F1 ) ; disp ( Fwt , Total V i s c o u s F r i c t i o n ( Fwt )= ) p r i n t f ( Te=t (Fwtw) \n ) Te=0.8 / / l o a d w=(tTe ) /Fwt ; disp (w, Speed o f Motor (w)= )
20
6.1
Scilab Code
Example F1 parallel.sce
1 2 3
1 2 3 4
1 2
exec s e r i e s . s c e ; s=%s ; 21
3 4 5 6 7 8 9 10 11
s y s 1=s y s l i n ( c , ( s +3) / ( s +1) ) s y s 2=s y s l i n ( c , 0 . 2 / ( s +2) ) s y s 3=s y s l i n ( c , 5 0 / ( s +4) ) s y s 4=s y s l i n ( c , 1 0 / ( s ) ) a=s e r i e s ( sys1 , s y s 2 ) ; b=s e r i e s ( a , s y s 3 ) ; y=s e r i e s ( b , s y s 4 ) ; y=simp ( y ) ; disp ( y , C( s ) /R( s )= ) This code requires S F1. Example 6.02 6.02.sci
1 2 3 4 5 6 7 8 9
exec p a r a l l e l . s c e ; s=%s ; s y s 1=s y s l i n ( c , 1 / s ) s y s 2=s y s l i n ( c , 2 / ( s +1) ) s y s 3=s y s l i n ( c , 3 / ( s +3) ) a=p a r a l l e l ( sys1 , s y s 2 ) ; y=p a r a l l e l ( a , s y s 3 ) ; y=simp ( y ) ; disp ( y , C( s ) /R( s )= ) This code requires S F2. Example 6.03 6.03.sci
1 2 3 4 5 6 7 8 9 10
exec s e r i e s . s c e ; s=%s ; s y s 1=s y s l i n ( c , 3 / ( s ( s +1) ) ) s y s 2=s y s l i n ( c , s 2 / ( 3 ( s +1) ) ) s y s 3=s y s l i n ( c , 6 / ( s ) ) a=(1) s y s 3 ; b=s e r i e s ( sys1 , s y s 2 ) ; y=b / . a // f e e d b a c k operation y=simp ( y ) disp ( y , C( s ) /R( s )= ) 22
exec p a r a l l e l . s c e ; syms G1 G2 G3 H; a=s e r i e s (G1 , G2) ; b=p a r a l l e l ( a , G3) ; y=b / .H / / n e g a t i v e f e e d b a c k y=s i m p l e ( y ) disp ( y , C( s ) /R( s )= ) Example 6.05 6.05.sci
operation
1 2 3 4 5 6 7
exec s e r i e s . s c e ; syms G1 G2 H1 H2 s ; a=G1 / . H1 ; / / n e g a t i v e f e e d b a c k o p e r a t i o n b=a / . H2 ; / / n e g a t i v e f e e d b a c k o p e r a t i o n y=s e r i e s ( b , G2) ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.06 6.06.sci
1 2 3 4 5 6 7 8 9 10 11 12
exec p a r a l l e l . s c e ; exec s e r i e s . s c e ; syms G1 G2 G3 G4 G5 G6 H1 H2 ; a=p a r a l l e l (G3 , G5) ; b=p a r a l l e l ( a,G4) ; c=s e r i e s (G1 , G2) ; d=c / . H1 ; e=s e r i e s ( b , d ) ; f=e / . H2 ; y=s e r i e s ( f , G6) ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.07 6.07.sci
23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
exec s e r i e s . s c e ; syms G1 G2 G3 H1 H2 R X;
// p u t t i n g x =0 , t h e n solving the block
a=G3 / . H1 ; b=s e r i e s (G1 , G2) ; c=s e r i e s ( a , b ) ; x1=c / . H2 ; C1=Rx1 ; disp ( x1 , C1( s ) /R( s )= )
// p u t t i n g r =0 , then solving the block
d=s e r i e s (G1 , G2) ; e=s e r i e s ( d , H2) ; f=G3 / . H1 ; x2=f / . e ; C2=Xx2 ; disp ( x2 , C2( s ) /X( s )= )
// r e s u l t a n t output C= C 1 + C 2
1 2 3 4 5 6 7 8 9 10 11 12
a=G3/G2 ; b=p a r a l l e l ( a , 1 ) ; c=s e r i e s (G1 , G2) ; d=c / . H1 / / n e g a t i v e e=s e r i e s ( d , b ) ; y=e / . H2 ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.09 6.09.sci
feedback
operation
24
1 2 3
exec s e r i e s . s c e syms G1 G2 G3 H1 H2 H3 ;
// Remove the feedback function loop H2 having feedback path transfer
4 5
a=G3 / . H2 ;
// I n t e r c h a n g e cascade the summer by its . as well as replace the block equivalent block
6 7 8 9 10 11
b=s e r i e s (G1 , G2) ; c=b / . H1 ; / / N e g a t i v e d=s e r i e s ( c , a ) ; y=d / . H3 ; / / N e g a t i v e y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.10 6.10.sci
Feedback
Operation
Feedback
Operation
1 2 3 4 5 6 7 8 9 10 11
exec p a r a l l e l . s c e ; exec s e r i e s . s c e ; syms G1 G2 G3 G4 G5 H1 H2 ; a=G2 / . H1 ; / / n e g a t i v e f e e d b a c k b=s e r i e s (G1 , a ) ; c=s e r i e s ( b , G3) ; d=p a r a l l e l ( c , G4) ; e=s e r i e s ( d , G5) ; y=e / . H2 ; // n e g a t i v e feedback y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.11 6.11.sci
operation
operation
1 2 3 4 5 6 7 8
c=G4 / . H1 ; d=G5/G4 ;
// n e g a t i v e // n e g a t i v e
feedback feedback
operation operation
25
9 10 11 12 13 14 15 16 17
e=p a r a l l e l ( d , 1 ) ; f=G6 / . H2 ; // n e g a t i v e g=s e r i e s ( b , c ) ; h=s e r i e s ( g , e ) ; i=s e r i e s ( h , f ) ; j=s e r i e s ( i , G7) ; y=j / . H3 ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.12 6.12.sci
feedback
operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
a=G3/G1 ; b=p a r a l l e l ( a , G2) ; c=G1 / . H1 ; / / N e g a t i v e F e e d b a c k O p e r a t i o n d=1/b ; // N e g a t i v e Feedback Operation e=p a r a l l e l ( d , H3) ; f=s e r i e s ( e , H2) ; g=s e r i e s ( c , b ) ; h=g / . f ; // N e g a t i v e Feedback Operation y=s e r i e s ( h , G4) ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.13 6.13.sci
1 2 3 4 5 6 7 8
a=G2 / . H2 ;
// p l a c e the summer l e f t to the block G1
b=G3/G1 ;
// e x c h a n g e the summer
26
9 10 11 12 13 14 15
c=p a r a l l e l ( b , 1 ) ; d=s e r i e s ( a , G1) ; e=s e r i e s ( d , G4) ; f=e / . H1 ; y=s e r i e s ( c , f ) ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.14 6.14.sci
1 2 3 4 5 6 7 8 9 10 11 12 13
a=H1/G3 ; b=s e r i e s (G2 , G3) ; c=p a r a l l e l (H2 , a ) ; d=b / . c ; e=s e r i e s ( d , G1) ; f=e / . a ; y=s e r i e s ( f , G4) ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= ) Example 6.15 6.15.sci
1 2 3 4 5
6 7 8 9 10 11
e=G4/G2 ; 27
12 13 14 15 16 17 18 19 20
f=s e r i e s ( d , G2) ;
// e x c h a n g e the summer
g=f / . H1 ; h=p a r a l l e l (G1 , e ) ; i=s e r i e s ( h , g ) ; j=s e r i e s ( a , H3) ; y=i / . j ; y=s i m p l e ( y ) ; disp ( y , C( s ) /R( s )= )
28
8.1
Scilab Code
s=%s ; p=poly ( [ 3 1 ] , s , c o e f f ) ; q=poly ( [ 0 1 0 . 9 5 0 . 2 1 ] , s , c o e f f ) ; G=p/q ; disp (G, G( s )= ) H=1; y=GH; / / T y p e 1 S y s t e m disp ( y , G( s )H( s )= )
// R e f e r i n g system the table & 8.2 Ka =0 given in the book , For type 1 Kp= % i n f
10 11 12 13
p r i n t f ( For type1 Kp=i n f & Ka=0 \n ) syms s ; Kv=l i m i t ( s y , s , 0 ) ; / / K v = v e l o c i t y e r r o r c o e f f i c i e n t disp (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 (Kv)= )
29
9 10 11
error
12
1 2 3 4 5 6
7 8
syms s Kp=l i m i t ( s y/ s , s , 0 )
//
Kp= p o s i t i o n a l
error
c o e f f i c i e n t
// r e f e r i n g Kp= % i n f
the &
table
8.2
given
in
the
book
, for
type
Kv= % i n f
8 9
/ / Ka= a c c e l a r a t i o n
error
c o e f f i c i e n t
1 2 3 4 5 6 7 8
Kv= % i n f
9 10 11
error
12 13 14 15 16 17 18 19
1 2 3 4 5 6 7
8 9 10 11 12 13 14
disp (F , 1/(1+G( s )H( s ) )= ) syms t s ; Ko=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 ( 1 / ( 1 + G ( s ) H ( S ) ) d=d i f f ( s F/ s , s ) ; K1=l i m i t ( d i f f ( s F/ s , s ) , s , 0 ) / / K 1 = L t s >0 ( d F ( s ) / d s K2=l i m i t ( d i f f ( d , s ) , s , 0 ) / / K 2 = L t s >0 ( d 2 F ( s ) / d s )
// g i v e n ) ) input is r ( t ) =4+3 t +8( t 2 ) /2
& R( s )= l a p l a c e ( r ( t
15 16 17 18 19
a=(4+3 t +8( t 2) / 2 ) b=d i f f (4+3 t +8( t 2) /2 , t ) c=d i f f ( b , t ) e=Koa+K1b+K2 c / / e r r o r b y disp ( e , e r r o r ) Example 8.06 8.06.sci
dynamic
c o e f f i c i e n t
method
1 2
polynomial // C r e a t e s
variable transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8 9 10 11 12 13 14
/ / Wn 2 = z ( 1 , 1 )
the //
c o e f f i c i e n t s Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
z e t a=z ( 1 , 2 ) /(2Wn) // z e t a =damping Wd Wn sqrt (1 z e t a 2) = Tp=%pi/Wd Mp=100exp((%pi z e t a ) / sqrt (1 z e t a 2) ) Example 8.07 8.07.sci
factor
s=poly ( 0 , s ) ;
// D e f i n e s
as
polynomial
variable
32
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8 9 10 11 12 13 14
/ / Wn 2 = z ( 1 , 1 )
the //
c o e f f i c i e n t s Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
factor
15 16 17 18
Td=(1+0.7 z e t a ) /Wn / / Td= d e l a y t i m e a=atan ( sqrt (1 z e t a 2) / z e t a ) Tr=(%pia ) /Wd // Tr= r i s e time Ts=4/( z e t a Wn) // Ts= s e t t l i n g time Example 8.08 8.08.sci
1 2 3 4 5 6
7 8 9 10 11 12 13
syms s Kv=l i m i t ( s y , s , 0 )
// g i v e n input is
/ / Kv=
velocity
error
c o e f f i c i e n t
r ( t ) =5 t
& R( s )= l a p l a c e ( r ( t ) )
R=l a p l a c e ( 5 t , t , s )
// s t e a d y state error =Lt s >0 sR ( S ) /1+G ( s ) H ( S ) for ramp input
8 9
syms s t ; Ka=l i m i t ( s 2y , s , 0 )
c o e f f i c i e n t // g i v e n input is
/ / Ka=
accelaration
error
10 11 12 13 14
r ( t ) =1+3 t + t 2 / 2
& R( s )= l a p l a c e ( r ( t ) )
1 2 3
internal
feedback
4 5 6 7 8 9 10 11 12 13 14
b=202a ; disp ( b , G( s ) ) c =1; disp ( c , H( s ) ) OL=b c ; disp (OL, G( s )H( s ) ) , G( s ) H( s ) ) syms t s ; Kp=l i m i t ( s OL/ s , s , 0 ) / / K p = p o s i t i o n e r r o r c o e f f i c i e n t Kv=l i m i t ( s OL, s , 0 ) / / K v = v e l o c i t y e r r o r c o e f f i c i e n t Ka=l i m i t ( s 2OL, s , 0 ) / / K a = a c c e l a r a t i o n e r r o r
c o e f f i c i e n t
34
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
// g i v e n
input
r ( t ) =6
R=l a p l a c e ( 6 , t , s )
// s t e a d y state error =Lt s >0 sR ( S ) /1+G ( s ) H ( S ) for given input
// e= e r r o r
M a p l a c e ( 8 t , t , s ) =l
// s t e a d y state error =Lt s >0 sR ( S ) /1+G ( s ) H ( S ) for given input
// e= e r r o r
r ( t ) = 1 0 + 4 t +3 t 2 / 2
// e= e r r o r
1 2 3 4 5 6 7 8 9 10 11 12 13 14
s = poly ( 0 , s ) s y s 1 = s y s l i n ( c , ( s ) / ( s +6) ) ; s y s 2 = s y s l i n ( c , ( s +2) / ( s +3) ) ; s y s 3 = s y s l i n ( c , ( 5 ) / ( ( s +3) s 3 ) ) ; a=s y s 2+s y s 3 ; disp ( a , H( s ) ) b=s y s 1 ; disp ( b , G( S ) ) y=ab ; disp ( y , G( S )H( S ) ) syms s Kp=l i m i t ( s y/ s , s , 0 ) / / K p = p o s i t i o n e r r o r c o e f f i c i e n t Kv=l i m i t ( s y , s , 0 ) / / K v = v e l o c i t y e r r o r c o e f f i c i e n t Ka=l i m i t ( s 2y , s , 0 ) / / K a = a c c e l a r a t i o n e r r o r
c o e f f i c i e n t
s=%s ; syms k t ; 35
3 4 5 6 7 8 9 10 11 12 13 14
y=k / ( ( s +1) s 2( s +4) ) ; disp ( y , G( s )H( s )= ) r =1+(8 t ) +(18 t 2/2) ; disp ( r , r ( t )= ) R=l a p l a c e ( r , t , s ) ; disp (R, R( s )= ) e=l i m i t ( ( s R) /(1+y ) , s , 0 ) disp ( e , Ess= ) p r i n t f ( Given Ess = 0 . 8 \n ) e =0.8; k=72/e ; d i s p ( k , k=) Example 8.13 8.13.sci
1 2 3 4 5 6 7 8 9 10 11 12
s )H( s )
/ / R= l a p l a c e ( 0 . 2 t , t , s )
// S o l v e s
The
Linear
Equation
1 2 3 4 5 6 7 8
//G( s )H( s )
9 10 11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//G( s )H( s )
1 2
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8
/ / Wn 2 = z ( 1 , 1 )
the
c o e f f i c i e n t s
37
9 10 11 12 13 14
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
//
Wn= n a t u r a l
frequency
factor
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7 8
loop
transfer
function
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
9 10 11 12 13 14 15
/ / Wn 2 = z ( 1 , 1 )
the //
c o e f f i c i e n t s Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
factor
16 17 18 19 20 21
Td=(1+0.7 z e t a ) /Wn / / Td= d e l a y t i m e a=atan ( sqrt (1 z e t a 2) / z e t a ) Tr=(%pia ) /Wd // Tr= r i s e time Ts=4/( z e t a Wn) // Ts= s e t t l i n g time
// y ( t )= e x p r e s s i o n for output
22
38
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7 8
loop
transfer
function
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
9 10 11 12 13 14 15
/ / Wn 2 = z ( 1 , 1 )
the //
c o e f f i c i e n t s Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
factor
16 17 18 19
Td=(1+0.7 z e t a ) /Wn / / Td= d e l a y t i m e a=atan ( sqrt (1 z e t a 2) / z e t a ) Tr=(%pia ) /Wd // Tr= r i s e time Ts=4/( z e t a Wn) // Ts= s e t t l i n g time Example 8.20 8.20.sci
1 2 3 4 5 6 7 8 9
i eee ( 2 ) ; syms k T; num=k ; den=s (1+ s T) ; G=num/ den ; disp (G, G( s )= ) H=1; CL=G/ .H; CL=s i m p l e (CL) ;
39
10
// C a l c u l a t e s
closed loop
11 12
13 14
//
coeff
of
den
of
symbolic
15 16 17 18
c o f a 1 = c o e f f s ( den , s , 1 )
/ / Wn 2 = cof a 0 , comparing the c o e f f i c i e n t s
//
Wn= n a t u r a l
19 20
1 2 3 4 5 6 7 8 9
s= poly ( 0 , s ) ; s y s = s y s l i n ( c , 1 0 / ( s +2) ) ; / / G ( disp ( sys , G( s )H( s ) ) F=1/(1+ s y s ) syms t s ; Co=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 a =(3) ; e=Coa ; disp ( e , s t e a d y s t a t e e r r o r ) Example 8.23-02 8.23.02.sci
s )H( s )
(1/(1+G( s )H( S ) )
1 2 3 4 5 6 7 8
s= poly ( 0 , s ) ; s y s = s y s l i n ( c , 1 0 / ( s +2) ) ; / / G ( s ) H ( s ) disp ( sys , G( s )H( s ) ) F=1/(1+ s y s ) syms t s ; Co=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 ( 1 / ( 1 + G ( d=d i f f ( s F/ s , s ) C1=l i m i t ( d i f f ( s F/ s , s ) , s , 0 ) / / K 1 = L t s >0 40
s )H( S ) )
( dF ( s ) / d s )
9 10 11 12
1 2 3 4 5 6 7 8 9 10 11 12 13 14
s= poly ( 0 , s ) ; s y s = s y s l i n ( c , 1 0 / ( s +2) ) ; / / G ( s ) H ( s ) disp ( sys , G( s )H( s ) ) F=1/(1+ s y s ) syms t s ; Co=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 ( 1 / ( 1 + G ( s ) H ( S ) ) d=d i f f ( s F/ s , s ) C1=l i m i t ( d i f f ( s F/ s , s ) , s , 0 ) / / K 1 = L t s >0 ( d F ( s ) / d s C2=l i m i t ( d i f f ( d , s ) , s , 0 ) / / K 2 = L t s >0 ( d 2 F ( s ) / d s ) a =(( t 2 ) / 2) ; b=d i f f ( ( t 2) /2 , t ) ; c=d i f f ( b , t ) ; e=Coa+C1b+C2 c ; disp ( e , s t e a d y s t a t e e r r o r ) Example 8.23-04 8.23.04.sci
1 2 3 4 5 6 7 8 9 10
s= poly ( 0 , s ) ; s y s = s y s l i n ( c , 1 0 / ( s +2) ) ; / / G ( s ) H ( s ) disp ( sys , G( s )H( s ) ) F=1/(1+ s y s ) syms t s ; Co=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 ( 1 / ( 1 + G ( s ) H ( S ) ) d=d i f f ( s F/ s , s ) C1=l i m i t ( d i f f ( s F/ s , s ) , s , 0 ) / / K 1 = L t s >0 ( d F ( s ) / d s C2=l i m i t ( d i f f ( d , s ) , s , 0 ) / / K 2 = L t s >0 ( d 2 F ( s ) / d s )
// g i v e n ) input is r ( t ) =1+2 t +( t 2 ) / 2
& R( s )= l a p l a c e ( r ( t )
11 12 13
14
e=Coa+C1b+C2 c
// e r r o r
by
dynamic
c o e f f i c i e n t
method
s= poly ( 0 , s ) ; s y s 1 = s y s l i n ( c , ( s +3) / ( s +5) ) ; s y s 2= s y s l i n ( c , ( 1 0 0 ) / ( s +2) ) ; s y s 3= s y s l i n ( c , ( 0 . 1 5 ) / ( s +3) ) ; G=s y s 1 s y s 2 s y s 3 25 H=1; y=GH; / / G ( s ) H ( s ) disp ( y , G( s )H( s ) ) F=1/(1+y ) syms t s ; Co=l i m i t ( s F/ s , s , 0 ) / / K o = L t s >0 ( 1 / ( 1 + G ( s ) H ( S ) ) d=d i f f ( s F/ s , s ) C1=l i m i t ( d i f f ( s F/ s , s ) , s , 0 ) / / K 1 = L t s >0 ( d F ( s ) / d s C2=l i m i t ( d i f f ( d , s ) , s , 0 ) / / K 2 = L t s >0 ( d 2 F ( s ) / d s ) a=(1+(2 t ) +(5( t 2/2) ) ) ; b=d i f f ( a , t ) ; c=d i f f ( b , t ) ; e=Coa+C1b+C2 c ; disp ( e , s t e a d t s t a t e e r r o r ) Example 8.32 8.32.sci
1 2 3 4 5 6 7 8 9 10 11 12
syms t s ; R=l a p l a c e ( 1 , t , s ) ; disp (R, R( s )= ) C=R s y s ; disp (C, C( s )= ) c=i l a p l a c e (C, s , t ) disp ( c , c ( t )= ) G=9/( s 3+0.6 s 2 ) ; 42
13 14 15 16 17 18 19 20 21 22 23
disp (G, G( s )= ) H=1; y=1+GH; syms t s ; Kp=l i m i t ( s G/ s , s , 0 ) Kv=l i m i t ( s G, s , 0 ) Ka=l i m i t ( s 2G, s , 0 ) R=l a p l a c e ( (1+ t +( t 2/2) ) , t , s )
// s t e a d y state error =Lt s >0 sR ( S ) /1+G ( s ) H ( S ) for ramp input
43
9.1
Scilab Code
at
44
16 17 18 19 20
F=y/(1+y ) disp (F , (G( s ) H( s ) ) /(1+G( s ) H( s ) ) ) S=horner (F , s ) / / c a l c u l a t e s v a l u e o f b=abs ( S ) disp ( b , s e n s i t i v i t y o f c l o s e d l o o p ) Example 9.02 9.02.sci
at
1 2 3 4 5 6 7 8 9 10
s=%s ; s y s 1=s y s l i n ( c , 9 / ( s ( s +1.8) ) ) ; syms Td ; s y s 2 =1+(s Td) ; s y s 3=s y s 1 s y s 2 ; H=1; CL=s y s 3 / .H; / / C a l c u l a t e s c l o s e d l o o p disp (CL, C( s ) /R( s ) )
// compare CL with
transfer
function
11 12
den=den / 5 ; c o f a 0 = c o e f f s ( den , s , 0 )
function CL
//
coeff
of
den
of
symbolic
13 14 15 16
c o f a 1 = c o e f f s ( den , s , 1 )
/ / Wn 2 = cof a 0 , comparing the c o e f f i c i e n t s
//
Wn= n a t u r a l
17 18 19 20 21 22 23
z e t a=c o f a 1 /(2Wn) z e t a =1; disp ( z e t a , f o r c r i t i c a l y damped f u n c t i o n z e t a ) Td=((2Wn) 1.8) /9 Ts=4/( z e t a Wn) ; Ts=d bl ( Ts ) ; disp ( Ts , s e t t l i n g time Ts ) Example 9.03 9.03.sci
s=%s ; 45
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
w=1.3 s=%iw S=horner ( S , s ) a=abs ( S ) disp ( a , s e n s i t i v i t y o f open l o o p ) F=y/(1+y ) disp (F , (G( s ) H( s ) ) /(1+G( s ) H( s ) ) ) S=horner (F , s ) b=abs ( S ) disp ( b , s e n s i t i v i t y o f c l o s e d l o o p ) Example 9.04 9.04.sci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
s=%s ; syms s ; syms Wn z e t a A H r e a l ; T= 6 . 2 8 ; Wn=(8%pi ) /T; z e t a =0.3 n= Wn 2 ; d=s 2+2 z e t a Wn s+ Wn 2 ; G1=n/d ; disp (G1 , G1( s ) ) G=AG1 ; disp (G, G( s ) ) S1=( d i f f (G,A) ) (A/G) ; a=s i m p l e ( S1 ) ; disp ( a , open l o o p s e n s i t i v i t y f o r changes i n A ) M =G/ .H; p=s i m p l e (M) S2=( d i f f ( p ,A) ) (A/p ) ; b=s i m p l e ( S2 ) ; 46
20 21 22 23
disp ( b , c l o s e d l o o p s e n s i t i v i t y f o r changes i n A ) S3=( d i f f ( p ,H) ) (H/p ) ; c=s i m p l e ( S3 ) ; disp ( c , c l o s e d l o o p s e n s i t i v i t y f o r changes i n H ) Example 9.05 9.05.sci
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
s=%s ; s y s 1=s y s l i n ( c , ( s +3)/ s ) ; syms u rp k H RL ; num2=uRL s ( s +2) ; den2=(rp+RL) ( s +3) ; s y s 2=num2/ den2 ; num3=k ; den3=s +2; s y s 3=num3/ den3 ; s y s=s y s 1 s y s 2 s y s 3 ; disp ( sys , G( s )= ) ; RL=10103; rp =4103; s y s=eval ( s y s ) s y s=f l o a t ( s y s ) disp ( sys , s y s= ) ; disp (H, H( s ) ) ; M y s / .H / / G ( s ) / 1 + G ( s ) H ( S ) =s M i m p l e (M) =s S=( d i f f (M, u ) ) ( u/M) ; S=s i m p l e ( S ) ; disp ( S , system s e n s i t i v i t y due t o v a r i a t i o n o f u= ) ; H= 0 . 3 ; u=12; S=eval ( S ) / / e q 1 S=0.04; k =((7/S ) 7)/18 ; / / f r o m e q 1 disp ( k , K= ) Example 9.06 9.06.sci 47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
G=210; H= 0 . 1 2 ; syms Eo Er p r i n t f ( f o r c l o s e d l o o p system ) s y s=G/ .H; / / E o / E r =G / ( 1 + GH ) disp ( sys , Eo/Er= ) Eo=240 / / g i v e n Er=Eo / 8 . 0 1 5 2 ; disp ( Er , Er= ) p r i n t f ( f o r open l o o p system ) disp (G, Eo/Er= ) Er=Eo/G; G=210; disp ( Er , Er= )
// p r i n t f ( s i n c e gain is G is reduced by 12%, the new value of 784.8 V) ;
16 17 18 19 20 21 22
S=1/(1+GH) disp ( S , ( %change i n M) / ( %change i n G)= ) disp ( 1 2 , %CHANGE IN G= ) y =120.03869; disp ( y , %CHANGE IN M ) = p r i n t f ( f o r open l o o p system ) disp ( 2 8 . 8 1 0 0 / 2 4 0 , %change i n Eo ) Example 9.07 9.07.sci
1 2 3 4 5 6 7 8 9 10 11 12
s=%s ; s y s 1=s y s l i n ( c , 2 0 / ( s ( s +2) ) ) ; syms Kt ; s y s 2=Kt s ; s y s 3=s y s 1 / . s y s 2 ; p=s i m p l e ( s y s 3 ) ; disp ( p , G( s )= ) H=1; s y s=s y s 3 / .H; s y s=s i m p l e ( s y s ) ; disp ( sys , C( s ) /R( s )= ) [ num , den ]=numden ( s y s ) 48
13
c o f a 0 = c o e f f s ( den , s , 0 )
function CL
//
coeff
of
den
of
symbolic
14 15 16 17 18
c o f a 1 = c o e f f s ( den , s , 1 )
/ / Wn 2 = cof a 0 , comparing the c o e f f i c i e n t s
//
Wn=
19 20 21 22 23 24 25 26 27 28 29 30 31
z e t a=c o f a 1 /(2Wn) zeta =0.6; Kt=((2 z e t a Wn) 2) / 2 0 ; disp ( Kt , Kt= ) Wd Wn sqrt (1 z e t a 2) ; = disp (Wd, Wd ) = Tp=%pi/Wd; disp (Tp , Tp= ) Mp=100exp((%pi z e t a ) / sqrt (1 z e t a 2) ) ; disp (Mp, Mp= ) Ts=4/( z e t a Wn) ; disp ( Ts , Ts= ) Example 9.08 9.08.sci
1 2 3 4 5 6 7 8
s=%s ; p r i n t f ( 1 ) z e t a & Wn without Kd ) G=60 s y s l i n ( c , 1 / ( s ( s +4) ) ) ; disp (G, G( S )= ) CL=G/ .H; disp (CL, C( s ) /R( s )= ) y=denom(CL) / / e x t r a c t i n g t h e d e n o m i n a t o r z=c o e f f ( y ) / / e x t r a c t i n g t h e c o e f f i c i e n t s
denominator polynomial , comparing the // c o e f f i c i e n t s Wn= n a t u r a l / / Wn 2 = z ( 1 , 1 )
of of
CL the
9 10 11 12 13
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
frequency
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
syms Kd ; p r i n t f ( 2 )Kd f o r z e t a =0.60 with c o n t r o l l e r ) s y s 2=s Kd ; s y s 3=s y s 1 / . s y s 2 ; G=s y s 3 6 0 ; disp (G, G( s )= ) H=1; s y s=G/ .H; disp ( sys , C( s ) /R( s )= ) [ num , den ]=numden ( s y s ) c o f a 0 = c o e f f s ( den , s , 0 ) c o f a 1 = c o e f f s ( den , s , 1 )
/ / Wn 2 = cof a 0 , comparing the c o e f f i c i e n t s
1 2 3 4 5 6 7 8 9
s=%s ; p r i n t f ( 1 ) without c o n t r o l l e r ) G=s y s l i n ( c , 1 2 0 / ( s ( s +12.63) ) ) ; disp (G, G( s )= ) H=1; CL=G/ .H; disp (CL, C( s ) /R( s )= ) y=denom(CL) / / e x t r a c t i n g t h e d e n o m i n a t o r z=c o e f f ( y ) / / e x t r a c t i n g t h e c o e f f i c i e n t s
denominator polynomial , comparing the c o e f f i c i e n t s / / Wn 2 = z ( 1 , 1 )
of of
CL the
10 11 12 13 14 15
//
Wn= n a t u r a l
frequency
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31 32
p r i n t f ( 2 ) with c o n t r o l l e r ) G=s y s l i n ( c , ( 1 2 0 ( 3 0 + s ) ) / ( s ( s +12.63) 30) ) ; d i s p (G, G( s )= ) CL=G/ .H; d i s p (CL, C( s ) /R( s )= ) den=denom (CL) den=den /30 // e x t r a c t i n g t he denominator o f CL z=c o e f f ( den ) // e x t r a c t i n g t he c o e f f i c i e n t s o f t he denominator p o l y n o m i a l //Wn2=z ( 1 , 1 ) , comparing t he c o e f f i c i e n t s Wn q r t ( z ( 1 , 1 ) ) ; =s d i s p (Wn, Wn ) = // Wn a t u r a l f r e q u e n c y =n //2 z e t a Wn ( 1 , 2 ) =z z e t a=z ( 1 , 2 ) /(2Wn) ; Mp=100 exp ((%pi z e t a ) / s q r t (1 z e t a 2) ) ; d i s p (Mp, Mp= ) Ts=4/( z e t a Wn) ; d i s p ( Ts , Ts= ) Example 9.10 9.10.sci
1 2 3 4 5 6 7 8 9 10
s=%s ; p r i n t f ( 1 ) without c o n t r o l l e r ) G=64 s y s l i n ( c , 1 / ( s ( s +4) ) ) ; disp (G, G( s )= ) H=1; CL=G/ .H; disp (CL, C( s ) /R( s )= )
// E x t r a c t i n g the denominator of CL
y=denom(CL)
// E x t r a c t i n g polynomial the c o e f f i c i e n t s of the denominator
11 12 13 14 15 16
z=c o e f f ( y )
/ / Wn 2 = z ( 1 , 1 ) , comparing the c o e f f i c i e n t s
Wn =sqrt ( z ( 1 , 1 ) ) ;
/ / Wn= n a t u r a l frequency
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
syms K; s y s 1=s y s l i n ( c , 1 / ( s ( s +4) ) ) ; s y s 2=s y s 1 / . ( s K) ; G=64 s y s 2 d i s p (G, G( s )= ) s y s=G/ .H; s y s=s i m p l e ( s y s ) ; d i s p ( sys , C( s ) /R( s )= ) [ num , den ]=numden ( s y s ) // C o e f f o f den o f s y m b o l i c f u n c t i o n CL c o f a 0 = c o e f f s ( den , s , 0 ) c o f a 1 = c o e f f s ( den , s , 1 ) //Wn2= c o f a 0 , comparing t he c o e f f i c i e n t s Wn q r t ( c o f a 0 ) =s Wn =db l (Wn) ; //Wn a t u r a l f r e q u e n c y =n d i s p (Wn, n a t u r a l f r e q u e n c y Wn ) = // c o f a 1 =2 z e t a Wn z e t a=c o f a 1 /(2Wn) zeta =0.6; k=(16 z e t a )4 d i s p ( k , K= ) Example 9.11 9.11.sci
1 2 3 4 5 6 7 8 9 10 11 12
p r i n t f ( 2 ) with c o n t r o l l e r ) syms K; s y s 1=s y s l i n ( c , 1 / ( s ( s +1.2) ) ) ; s y s 2=s y s 1 / . ( s K) ; G=16 s y s 2 ; G=s i m p l e (G) d i s p (G, G( s )= ) s y s=G/ .H; s y s=s i m p l e ( s y s ) ; d i s p ( sys , C( s ) /R( s )= ) [ num , den ]=numden ( s y s ) den=den / 5 ; // so t h a t c o e f f o f s 2=1 52
13
14 15 16 17 18
19 20 21 22 23 24 25 26 27 28 29 30 31
c o f a 0 = c o e f f s ( den , s , 0 ) // c o e f f o f den o f s y m b o l i c f u n c t i o n CL c o f a 1 = c o e f f s ( den , s , 1 ) //Wn2= c o f a 0 , comparing t he c o e f f i c i e n t s Wn q r t ( c o f a 0 ) =s Wn =db l (Wn) ; d i s p (Wn, n a t u r a l f r e q u e n c y Wn ) = // Wn = natural frequency // c o f a 1 =2 z e t a Wn // z e t a=c o f a 1 /(2Wn) zeta =0.56; k=(8 z e t a ) 1.2 d i s p ( k , K= ) Wd Wn s q r t (1 z e t a 2) ; = d i s p (Wd, Wd ) = Tp=%pi/Wd; d i s p (Tp , Tp= ) Mp=100 exp ((%pi z e t a ) / s q r t (1 z e t a 2) ) ; d i s p (Mp, Mp= ) Ts=4/( z e t a Wn) ; d i s p ( Ts , Ts= )
53
Chapter 10 Stability
Install Symbolic Toolbox.Refer the spoken tutorial on the link (www.spokentutorial.org) for the installation of Symbolic Toolbox. You can also refer the inbuilt function(routh-t) for generating Routh Table.
10.1
Scilab Code
1 2 3
4 5 6 7 8 9
G=p/q ; H=poly ( [ 0 1 ] , s , c o e f f ) ;
// c h a r a c t e r i s t i c equation is 1+G ( s ) H ( s ) =0
1 2 3 4 5 6 7
1 2 3 4 5 6 7
s=%s ; m 3+5 s 2+10 s +3; =s r=c o e f f (m) n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] ; r outh =[ 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
routh matrix
sub
block
of
8 9 10 11 12 13 14 15 16 17 18
r outh =[ routh ;det ( t ) / t ( 2 , 1 ) , 0 ] c =0; for i =1:n i f ( routh ( i , 1 )< 0 ) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end 55
s=%s ; m 3+2 s 2+3 s +10; =s r=c o e f f (m) n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] ; r outh =[ 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
routh matrix
sub
block
of
8 9 10 11 12 13 14 15 16 17 18
r outh =[ routh ;det ( t ) / t ( 2 , 1 ) , 0 ] c =0; for i =1:n i f ( routh ( i , 1 ) <0) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end Example 10.05-01 10.05.01.sci
1 2 3 4 5 6 7
9 10
i eee ( 2 ) s=%s ; m 4+6 s 3+21 s 2+36 s +20 =s r=c o e f f (m) n=length ( r ) ; r outh =[ r ( [ 5 , 3 , 1 ] ) ; r ( [ 4 , 2 ] ) , 0 ] r outh =[ routh ;det ( routh ( 1 : 2 , 1 : 2 ) ) / routh ( 2 , 1 ) ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) , 0 , 0 ] ; disp ( routh , routh= ) 56
11 12 13 14 15 16 17 18 19 20
c =0; for i =1:n i f ( routh ( i , 1 ) <0) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end Example 10.05-02 10.05.02.sci
1 2 3 4 5 6
9 10 11 12 13 14 15 16 17 18 19
s=%s ; m 5+6 s 4+3 s 3+2 s 2+ s+1 =s r=c o e f f (m) n=length ( r ) r outh =[ r ( [ 6 , 4 , 2 ] ) ; r ( [ 5 , 3 , 1 ] ) ] r outh =[ routh ;det ( routh ( 1 : 2 , 1 : 2 ) ) / routh ( 2 , 1 ) ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) ,det ( routh ( 3 : 4 , 2 : 3 ) ) / routh ( 4 , 2 ) , 0 ] r outh =[ routh ;det ( routh ( 4 : 5 , 1 : 2 ) ) / routh ( 5 , 1 ) , 0 , 0 ] c =0; for i =1:n i f ( routh ( i , 1 ) <0) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end Example 10.06 10.06.sci 57
1 2 3 4
of
the
5 6 7 8 9
10
11 12 13 14
n=length ( r ) ; r outh =[ r ( [ 6 , 4 , 2 ] ) ; r ( [ 5 , 3 , 1 ] ) ] syms eps ; r outh =[ routh ; eps ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) ,det ( routh ( 3 : 4 , 2 : 3 ) ) / routh ( 4 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 4 : 5 , 1 : 2 ) ) / routh ( 5 , 1 ) , 0 , 0 ] ; disp ( routh , routh= )
/ / To check the s t a b i l i t y // P u t t i n g the value of
15 16
// P u t t i n g
the
17 18 19
disp ( routh ( 5 , 1 ) , routh ( 5 , 1 ) = ) r outh p r i n t f ( There a r e two sign changes o f f i r s t column , hence t h e system i s u n s t a b l e \n ) Example 10.07 10.07.sci
1 2 3
generates
the
Routh
4 5 6 7 8 9
10 11 12 13
1 2 3 4 5 6
8 9 10 11 12 13 14 15 16 17 18
s=%s ; m 4+5 s 3+2 s 2+3 s+2 =s r=c o e f f (m) n=length ( r ) ; r outh =[ r ( [ 5 , 3 , 1 ] ) ; r ( [ 4 , 2 ] ) , 0 ] r outh =[ routh ;det ( routh ( 1 : 2 , 1 : 2 ) ) / routh ( 2 , 1 ) ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) , 0 , 0 ] c =0; for i =1:n i f ( routh ( i , 1 ) <0) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end Example 10.09 10.09.sci
1 2 3 4
c o e f f i c i e n t
of
the
5 6 7
8 9
10
11 12 13 14
r outh =[ routh ; eps ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) ,det ( routh ( 3 : 4 , 2 : 3 ) ) / routh ( 4 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 4 : 5 , 1 : 2 ) ) / routh ( 5 , 1 ) , 0 , 0 ] ; disp ( routh , routh= )
/ / To check the s t a b i l i t y // P u t t i n g the value
15 16
// P u t t i n g
the
17 18 19
disp ( routh ( 5 , 1 ) , routh ( 5 , 1 ) = ) r outh p r i n t f ( There a r e two sign changes o f f i r s t column , hence t h e system i s u n s t a b l e \n ) Example 10.10 10.10.sci
1 2 3 4 5 6 7 8 9 10 11 12 13 14
i eee ( 2 ) ; syms s k ; m 4+4 s 3+7 s 2+6 s+k ; =s c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; c o f a 3 = c o e f f s (m, s , 3 ) ; c o f a 4 = c o e f f s (m, s , 4 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 cof a 4 ]
15
16
n=length ( r ) ; r outh =[ r ( [ 5 , 3 , 1 ] ) ; r ( [ 4 , 2 ] ) , 0 ] r outh =[ routh ;det ( routh ( 1 : 2 , 1 : 2 ) ) / routh ( 2 , 1 ) ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) , 0 , 0 ] ; 60
17
1 2 3 4 5 6 7 8 9 10 11 12
i eee ( 2 ) ; syms s k ; m=(24/100) s 3+ s 2+ s+k ; c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; c o f a 3 = c o e f f s (m, s , 3 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 ] n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] r outh =[ 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
routh matrix
sub
block
of
13 14 15 16 17 18 19 20
r outh =[ routh ;det ( t ) / routh ( 3 , 1 ) , 0 ] disp ( routh , routh= ) ; r outh ( 3 , 1 ) =0 / / F o r m a r g i n a l y s t a b l e s y s t e m k =1/0.24; disp ( k , K( m a r g i n a l )= ) disp ( =0 , ( s 2)+k , a u x i l l a r y e q u a t i o n ) s=sqrt(k ) ; disp ( s , Frequency o f o s c i l l a t i o n ( i n rad / s e c )= ) Example 10.12 10.12.sci
1 2 3 4 5 6 7 8 9 10
i eee ( 2 ) ; syms p K s ; m 3+(p s 2 ) +(K+3) s +(2(K+1) ) =s c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; c o f a 3 = c o e f f s (m, s , 3 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 ] n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] ; 61
11 12
sub
block
of
13 14
r outh =[ routh ;det ( t ) / routh ( 3 , 1 ) , 0 ] ; disp ( routh , routh= ) Example 10.13 10.13.sci
1 2 3 4 5
// G e n e r a t e s // G i v e s the
the
Routh of
Roots
13
i eee ( 2 ) ; syms s k ; m 4+6 s 3+10 s 2+8 s+k ; =s c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; c o f a 3 = c o e f f s (m, s , 3 ) ; c o f a 4 = c o e f f s (m, s , 4 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 c o f a 4 ] n=length ( r ) ; r outh =[ r ( [ 5 , 3 , 1 ] ) ; r ( [ 4 , 2 ] ) , 0 ] r outh =[ routh ;det ( routh ( 1 : 2 , 1 : 2 ) ) / routh ( 2 , 1 ) ,det ( routh ( 1 : 2 , 2 : 3 ) ) / routh ( 2 , 2 ) , 0 ] ; r outh =[ routh ;det ( routh ( 2 : 3 , 1 : 2 ) ) / routh ( 3 , 1 ) ,det ( routh ( 2 : 3 , 2 : 3 ) ) / routh ( 3 , 2 ) , 0 ] ; 62
14 15
r outh =[ routh ;det ( routh ( 3 : 4 , 1 : 2 ) ) / routh ( 4 , 1 ) , 0 , 0 ] ; disp ( routh , routh= ) Example 10.15 10.15.sci
1 2 3 4 5 6 7 8 9 10 11
i eee ( 2 ) ; syms s T; m 2+(2T) s+1 =s c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 ] n=length ( r ) ; r outh =[ r ( [ 3 , 1 ] ) ; r ( 2 ) , 0 ] ; r outh =[ routh ;det ( routh ) / routh ( 2 , 1 ) , 0 ] ; disp ( routh , routh= ) Example 10.16 10.16.sci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
i eee ( 2 ) s=%s ; m 6+2 s 5+7 s 4+10 s 3+14 s 2+8 s+8 =s r outh=routh t (m) ; disp ( routh , routh= ) c =0; for i =1:n i f ( routh ( i , 1 ) <0) c=c +1; end end i f ( c>=1) p r i n t f ( system i s u n s t a b l e ) e l s e ( system i s s t a b l e ) end
63
11.1
Scilab Code
s=%s ; s y s 1=s y s l i n ( c , 1 / ( s +1) ) ; evans ( sys1 , 2 0 0 ) p r i n t f ( I f k i s v a r i e d from 0 t o any v a l u e , r o o t l o c u s v a r i e s from k t o 0 \n ) Example 11.02 11.02.sci
1 2 3 4
s=%s ; s y s 1=s y s l i n ( c , ( s +1) / ( s +4) ) ; evans ( sys1 , 1 0 0 ) p r i n t f ( r o o t l o c u s b e g i n s a t s=4 & ends a t s=1 ) Example 11.03 11.03.sci
64
s=%s ; s y s 1=s y s l i n ( c , ( s+3%i ) ( s+3+%i ) / ( ( s+2%i ) ( s+2+%i ) ) ) ; evans ( sys1 , 1 0 0 ) p r i n t f ( R o o t l o c u s s t a r t s from s=2+i & 2 i ends a t s =3+i &3 i \n ) Example 11.04 11.04.sci
1 2 3
6 7 8 9
P=1+%i ; / / P= s e l e c t e d point k1=1/r e a l ( horner (H, P) ) Ns=H( num ) ; Ds=H( den ) ; roots ( Ds+k1Ns ) // do es not
root
contains
as
particular
10 11
point
66
not
contains
as
particular
//
there lie
is on
process of the
to
check
whether
the
points
system
6 7 8 9 10
P= 0.85; / / P= s e l e c t e d point k=1/r e a l ( horner (H, P) ) ; disp ( k , k = ) Ns=H( num ) ; Ds=H( den ) ; r o o t s ( Ds+kNs ) // c o n t a i n s P as p a r t i c u l a r r o o t
68
6 7 8
69
1 2 3 4
s=%s ; H=s y s l i n ( c , ( s +2) / ( ( s +1) s ( s +4) ) ) ; evans (H, 1 0 0 ) p r i n t f ( From t he graph we o b s e r v e d that , \n a ) The no o f l o c i ending a t i n f i s 2 \n b ) Three l o c i w i l l s t a r t from s= 0,1 & 4,\n c ) One l o c i w i l l end a t 2 & 70
s=%s ; H=s y s l i n ( c , ( s +2) / ( ( s +1) s ( s +4) ) ) ; evans (H, 1 0 0 ) Example 11.10 11.10.sci
n=3; 71
disp ( n , no o f p o l e s= ) m=1; disp (m, no o f p o l e s= ) q=0; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) q=1; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) p r i n t f ( C e n t r o i d =((sum o f a l l r e a l p a r t o f p o l e s o f G( s )H( s ) ) (sum o f a l l r e a l p a r t o f z e r o s o f G( s )H( s ) ) / ( 72
13 14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
n=3; disp ( n , no o f p o l e s= ) m=0; disp (m, no o f p o l e s= ) q=0; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) q=1; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) q=2; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) p r i n t f ( C e n t r o i d =((sum o f a l l r e a l p a r t o f p o l e s o f G( s )H( s ) ) (sum o f a l l r e a l p a r t o f z e r o s o f G( s )H( s ) ) / ( n m) \n ) C=((011)(0) ) / 3 ; disp (C, c e n t r o i d= ) Example 11.12 11.12.sci
16 17
1 2 3 4 5 6 7 8 9 10
n=4; disp ( n , no o f p o l e s= ) m=1; disp (m, no o f p o l e s= ) q=0; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) q=1; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) 73
11 12 13 14 15
q=2; O=((2 q ) +1) / ( n 1 8 0 ; m) disp (O, q= ) p r i n t f ( C e n t r o i d =((sum o f a l l r e a l p a r t o f p o l e s o f G( s )H( s ) ) (sum o f a l l r e a l p a r t o f z e r o s o f G( s )H( s ) ) / ( n m) \n ) C=((0245)(3) ) / 3 ; disp (C, c e n t r o i d= ) Example 11.13 11.13.sci
16 17
1 2 3 4
s=%s ; H=s y s l i n ( c , ( s +2) / ( ( s +1) s ( s +3) ) ) ; plzr (H) p r i n t f ( There a r e two a d j a c e n t p l a c e d p o l e s a t s=0 &s =1 \n ) p r i n t f ( One breakaway p o i n t e x i s t s between s=0 & s=1 \ n ) Example 11.14 11.14.sci
1 2 3 4
s=%s ; H=s y s l i n ( c , ( ( s +2) ( s +4) ) / ( ( s 2 ) ( s +5) ) ) ; plzr (H) p r i n t f ( There a r e two a d j a c e n t p l a c e d z e r o s a t s=2 &s =4 \n ) p r i n t f ( One b r e a k i n p o i n t e x i s t s between s=2 & s=4 \n ) Example 11.15 11.15.sci
1 2 3 4
s=%s ; H=s y s l i n ( c , ( s +6) / ( ( s +1) ( s +3) ) ) ; plzr (H) p r i n t f ( There a r e two a d j a c e n t p l a c e d p o l e s a t s=3 &s =1 \n ) 74
p r i n t f ( One breakaway p o i n t e x i s t s between s=3 & s=1 \n ) p r i n t f ( One b r e a k i n p o i n t e x i s t s t o th e l e f t o f z e r o s a t s=6 \n ) Example 11.16 11.16.sci
1 2 3 4
s=%s ; H=s y s l i n ( c , 1 / ( ( s +1) s ( s +3) ) ) ; plzr (H) p r i n t f ( There a r e two a d j a c e n t p l a c e d p o l e s a t s=0 &s 75
Figure 11.10: Output of S 11.14 =1 \n ) p r i n t f ( One breakaway p o i n t e x i s t s between s=0 & s=1 \ n ) Example 11.17 11.17.sci
1 2 3 4 5
s=%s ; H=s y s l i n ( c , 1 / ( ( s +1) s ( s +3) ) ) ; evans (H, 1 0 0 ) syms k ; m 3+6 s 2+8 s+k ; =s 76
c o f a 0 = c o e f f s (m, s , 0 ) ; c o f a 1 = c o e f f s (m, s , 1 ) ; c o f a 2 = c o e f f s (m, s , 2 ) ; c o f a 3 = c o e f f s (m, s , 3 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 ] n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] ; r outh =[ 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
routh matrix
sub
block
of
16
1 2 3
1 2 3
s=%s ; num=r e a l ( poly ( [ 1 ] , s , c o e f f ) ) den=r e a l ( poly([1,2+%i,2%i ] , s ) ) H=num/ den evans (H, 1 0 0 ) k =1.5; disp ( k , K( d e s i g n )= )
// Kpure calculates the value of k at imaginary crossover
[ K,Y]=kpure (H) 80
1 2 3 4 5
82
s=%s ; H=s y s l i n ( c , 1 / ( ( s +1) s ( s +2) ( s +4) ) ) ; evans (H, 1 0 0 ) Example 11.26 11.26.sci
1 2 3
s=%s ; syms k Wn; H=s y s l i n ( c , 1 / ( ( s +3) 2 s ) ) ; evans (H, 1 0 0 ) / / r o o t l o c u s p r i n t f ( To d e t e r m i n e t h e v a l u e o f Wn \n ) disp ( kH, G( s )H( s )= ) y=1+(kH) ; disp ( =0 , y , 1+G( s )H( s ) ) evans (H, 1 0 0 ) 84
[ num , den ]=numden ( y ) c o f a 0 = c o e f f s (num , s , 0 ) ; c o f a 1 = c o e f f s (num , s , 1 ) ; c o f a 2 = c o e f f s (num , s , 2 ) ; c o f a 3 = c o e f f s (num , s , 3 ) ; r =[ c o f a 0 c o f a 1 c o f a 2 c o f a 3 ] n=length ( r ) ; r outh =[ r ( [ 4 , 2 ] ) ; r ( [ 3 , 1 ] ) ] ; r outh =[ 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 85
sub
block
of
matrix
disp ( =0 , ( ( 6 s 2) +54) , a u x i l l a r y eq ) p=(6( s 2 ) )+k ; s=%iWn k =54; p=eval ( p ) Wn =sqrt ( k /6 ) p r i n t f ( With gvn v a l u e s o f z e t a adding a g r i d on r o o t l o c u s \n )
31
86
32 33
// add
grid
over
an
splane
root
with
given
34
35
36 37 38
p=locate ( 1 )
// d e s i r e d
point
on
the
root
locus
87
88
89
12.1
Scilab Code
polynomial // C r e a t e s
variable transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8 9 10 11 12 13 14
/ / Wn 2 = z ( 1 , 1 )
the //
c o e f f i c i e n t s Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
z e t a=z ( 1 , 2 ) /(2Wn) // z e t a =damping factor Mr=1/(2 z e t a sqrt (1 z e t a 2) ) Wr= Wn sqrt (1 z e t a 2) Wc= Wn sqrt ((1 2 z e t a 2)+sqrt (4 z e t a 44 z e t a 2+2) ) 90
15
BW =Wc
/ / BANDWIDTH
polynomial // C r e a t e s
variable transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8 9 10 11 12 13 14 15
/ / Wn 2 = z ( 1 , 1 )
the
c o e f f i c i e n t s // Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
z e t a=z ( 1 , 2 ) /(2Wn) // z e t a =damping factor Mr=1/(2 z e t a sqrt (1 z e t a 2) ) Wr= Wn sqrt (1 z e t a 2) Wc= Wn sqrt ((1 2 z e t a 2)+sqrt (4 z e t a 44 z e t a 2+2) ) BW =Wc / / BANDWIDTH Example 12.03 12.03.sci
1 2
polynomial // C r e a t e s
variable transfer
// C r e a t e s
transfer
4 5 6 7
CL=F / .B
//
// C a l c u l a t e s CL with
closed loop
transfer
function
compare
y=denom(CL) z=c o e f f ( y )
// e x t r a c t i n g // e x t r a c t i n g polynomial , comparing
denominator
8 9 10
/ / Wn 2 = z ( 1 , 1 )
the
c o e f f i c i e n t s // Wn= n a t u r a l frequency
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
91
11 12 13 14 15
z e t a=z ( 1 , 2 ) /(2Wn) // z e t a =damping factor Mr=1/(2 z e t a sqrt (1 z e t a 2) ) Wr= Wn sqrt (1 z e t a 2) Wc= Wn sqrt ((1 2 z e t a 2)+sqrt (4 z e t a 44 z e t a 2+2) ) BW =Wc / / BANDWIDTH Example 12.04 12.04.sci
1 2 3 4 5 6 7 8 9 10 11
// D e f i n e s
as
polynomial
variable
s=poly ( 0 , s ) ;
// C r e a t e s transfer function in forward path
F=s y s l i n ( c , [ 8 1 / ( ( s +18) s ) ] ) ;
// C r e a t e s transfer function in backward path
CL=F / .B
// compare CL with Wn 2 / ( s 2 + 2 z e t a Wn+Wn 2 ) the denominator of the of CL
y=denom(CL) / /
// E x t r a c t i n g polynomial
extracting the
c o e f f i c i e n t s
denominator
12 13 14 15 16 17 18
z=c o e f f ( y )
/ / Wn 2 = z ( 1 , 1 ) , comparing the c o e f f i c i e n t s
Wn =sqrt ( z ( 1 , 1 ) )
/ / 2 z e t a Wn= z ( 1 , 2 )
z e t a=z ( 1 , 2 ) /(2Wn)
// zeta =damping here factor becomes Mr =1 complex so the / / NOTE = other s q r t (1 2 z e t a 2 ) is Wr = 0 &
solution
19 20 21 22
Mr=1 Wr=0 Wc= Wn((1 2 z e t a 2)+sqrt (4 z e t a 44 z e t a 2+2) ) BW =Wc / / BANDWIDTH Example 12.05 12.05.sci
1 2 3
4 5 6 7 8 9 10
den=s ( a+s ) ; G=num/ den ; disp (G, G( s )= ) H=1; CL=G/ .H; CL=s i m p l e (CL) ; disp (CL, C( s ) /R( s )= )
transfer function CL with // compare
// C a l c u l a t e s
closed loop
11 12
13
c o f a 0 = c o e f f s ( den , s , 0 ) ;
symbolic function ( CL )
//
coeff
of
den
of
14 15 16 17 18 19 20 21 22 23 24 25 26 27
c o f a 1 = c o e f f s ( den , s , 1 ) ;
/ / Wn 2 = cof a 0 , comparing the c o e f f i c i e n t s
Wn =sqrt ( c o f a 0 )
// c o f a 1 = 2 z e t a Wn
/ / 1)
k = 1 . 2 5 a 2 2
p r i n t f ( 2ka2=320 \n )
// now eq 2 &4 of & k can &a be simultaneously soved to take out values
28 29 30 31 32 33 34 35 36 37
//
Let
k=x
a 2= y // c o e f f i c i e n t matrix
93
38 39 40 41 42 43
z e t a=db l ( eval ( z e t a ) ) ; disp ( z e t a , z e t a = ) Ts=4/( z e t a Wn) ; d i s p ( Ts , S e t t l i n g Time ( Ts )= ) Wc= Wn((1 (2 z e t a 2) )+s q r t (4 z e t a 44 z e t a 2+2) ) d i s p (Wc, BW ) =
94
13.1
Scilab Code
as
polynomial
variable function in
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7 8
OL=FB / / C a l c u l a t e s fmin = 0 . 1 ; / / M i n f r e q fmax =100; / / M a x f r e q scf (1) ; c l f ; bode (OL, fmin , fmax ) ;
loop system in
open l o o p in in Hz Hz
transfer
function
// P l o t s
frequency
response
of
open
Bode
// d i s p l a y
crossover
frequencies
s=poly ( 0 , s ) ;
// D e f i n e s
as
polynomial
variable
95
F=s y s l i n ( c , [ 2 0 / ( ( 2 + s ) s ) ] ) ;
function in forward path
// C r e a t e s
transfer
// C r e a t e s
transfer
4 5 6 7
transfer
function
// P l o t s
frequency
response
of
open
Bode
// d i s p l a y
crossover
frequencies
97
// C r e a t e s
transfer
4 5 6 7 8
OL=FB ; / / C a l c u l a t e s fmin = 0 . 1 ; / / M i n f r e q fmax =20; / / M a x f r e q scf (1) ; c l f ; bode (OL, fmin , fmax ) ;
loop system in
open l o o p in in Hz Hz
transfer
function
// P l o t s
frequency
response
of
open
Bode
[ Hz ] [ deg ]
10
// C a l c u l a t e s of phase
phase margin
[ Hz ]
11
PhaseMargin=180+Phase
[ deg ]
// C a l c u l a t e s
actual
phase
margin
12
// d i s p l a y
gain
and
phase
margin
and
crossover
frequencies
4 5 6 7 8
OL=FB ; / / C a l c u l a t e s fmin = 0 . 1 ; / / M i n f r e q fmax =20; / / M a x f r e q scf (1) ; c l f ; bode (OL, fmin , fmax ) ;
loop system in
open l o o p in in Hz Hz
transfer
function
// P l o t s
frequency
response
of
open
Bode
// d i s p l a y
crossover
frequencies
s=poly ( 0 , s ) ;
// D e f i n e s
as
polynomial
variable
98
//
// C r e a t e s
transfer
4 5 6 7 8
OL=FB / / C a l c u l a t e s fmin = 0 . 1 ; / / M i n f r e q fmax =20; / / M a x f r e q scf (1) ; c l f ; bode (OL, fmin , fmax ) ;
loop system in
open l o o p in in Hz Hz
transfer
function
// P l o t s
frequency
response
of
open
Bode
// d i s p l a y
crossover
frequencies
99
// C r e a t e s
transfer
4 5 6
open l o o p in in Hz Hz
transfer
function
100
// P l o t s
frequency
response
of
open
Bode
// d i s p l a y
crossover
frequencies
101
102
15.1
Scilab Code
s=%s ; s y s=s y s l i n ( c , 1 / ( s +2) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n h e r e t he number o f z e r o s o f 1+G( s )H( s ) i n th e RHP i s z e r o \n hence t h e system i s s t a b l e ) Example 15.02 15.02.sci
1 2 3 4 5
s=%s ; s y s=s y s l i n ( c , 1 / ( s ( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n h e r e t he number o f z e r o s o f 1+G( s )H( s ) i n th e RHP i s z e r o \n hence t h e system i s s t a b l e )
103
s=%s ; s y s=s y s l i n ( c , 1 / ( s 2( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n h e r e t he number o f z e r o s o f 1+G( s )H( s ) i n th e 104
Figure 15.2: Output of S 15.02 RHP i s not e q u a l t o z e r o \n hence t he system i s unstable ) Example 15.04 15.04.sci
1 2 3 4 5
s=%s ; s y s=s y s l i n ( c , 1 / ( s 3( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n h e r e t he number o f z e r o s o f 1+G( s )H( s ) i n th e 105
Figure 15.3: Output of S 15.03 RHP i s N>0 \n hence t he system i s u n s t a b l e ) Example 15.05 15.05.sci
1 2 3 4 5
s=%s ; s y s=s y s l i n ( c , 1 / ( s 2( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n h e r e t he number o f z e r o s o f 1+G( s )H( s ) i n th e RHP i s N>0 \n hence t he system i s u n s t a b l e ) 106
s=%s ; P1=1; P2=2; s y s=s y s l i n ( c , 1 / ( ( s +1) ( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n\n Here t he number o f z e r o s o f 1+G( s )H( s ) i n t he RHP i s z e r o \n\n Hence t h e system i s s t a b l e )
107
s=%s ; s y s=s y s l i n ( c , 1 2 / ( s ( s +1) ( s +2) ) ) nyquist ( s y s ) show margins ( sys , n y q u i s t ) gm=g margin ( s y s ) i f (gm<=0) p r i n t f ( system i s u n s t a b l e ) else p r i n t f ( system i s s t a b l e ) ; end ;
108
7 8
s=%s ; s y s=s y s l i n ( c , ( 3 0 ) / ( ( s 2+2 s +2) ( s +3) ) ) nyquist ( s y s ) gm=g margin ( s y s ) show margins ( sys , n y q u i s t ) p r i n t f ( S i n c e P=0(no o f p o l e s i n RHP)=P o l e s o f G( s )H( s ) \n Here t he number o f z e r o s o f 1+G( s )H( s ) i n th e RHP i s z e r o \n Hence t h e system i s s t a b l e ) i f (gm<=0) p r i n t f ( system i s u n s t a b l e ) 109
110
111
17.1
Scilab Code
s=%s ;
// C r e a t i n g cont time transfer function
1 2
3 4
s=%s ; TFcont=s y s l i n ( c , [ ( 7 + 2 s + 3( s 2) ) / (5 + 12 s + 5( s 2) + s 3 ) ] ) SScont=t f 2 s s ( TFcont ) [ Ac , Bc , U, in d ]=canon ( SScont ( 2 ) , SScont ( 3 ) ) Example 17.06 17.06.sci
112
1 2 3 4 5 6
s=%s ;
// C r e a t i n g cont time transfer function
1 2 3 4 5 6
s=%s ;
// C r e a t i n g cont time transfer function
1 2 3 4 5 6
s=%s ;
// C r e a t i n g cont time transfer function
1 2 3 4 5 6
A=[0 1; 6 5] [ Row Col ]= s i z e (A) / / S i z e o f a m a t r i x l=poly ( 0 , l ) ; m eye (Row, Col )A / / l I A =l n=det (m) / / T o F i n d T h e D e t e r m i n a n t roots ( n ) / / T o F i n d T h e V a l u e O f l Example 17.10 17.10.sci
of
l i A
A=[2 1 ; 0 3] 113
2 3 4 5 6 7 8 9 10
B= [ 0 ; 1 ] C=[1 1 ] s=poly ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e of a matrix m eye (Row, Col )A / / s I A =s n=det (m) / / To F i n d T h e D e t e r m i n a n t of p=inv (m) / / To F i n d T h e I n v e r s e O f y=CpB ; / / T o F i n d C ( s I A ) 1 B disp ( y , T r a n s f e r Function= ) Example 17.11 17.11.sci
s i A s I A
1 2 3 4 5 6 7 8 9 10 11 12 13
14 15 16 17 18 19 20 21 22
A=[0 1; 6 5] x=[1;0]; disp ( x , x ( t ) = ) s=p o l y ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e o f a matrix m eye (Row, Col )A =s // s I A n=d e t (m) //To Find The Determinant o f s i A p=i n v (m) ; // To Find The I n v e r s e Of s I A syms t s ; d i s p ( p , p hi ( s )= ) // R e s o l v e n t Matrix f o r i =1:Row f o r j =1: Col // Taking I n v e r s e L a p l a c e o f each element o f Matrix p h i ( s) q ( i , j )=i l a p l a c e ( p ( i , j ) , s , t ) ; end ; end ; d i s p ( q , p h i ( t )= ) // S t a t e T r a n s i t i o n Matrix r=i n v ( q ) ; r=s i m p l e ( r ) ; //To Find ph i ( t ) d i s p ( r , p h i ( t )= ) y=qx ; //x ( t )=p h i ( t ) x ( 0 ) d i s p ( y , S o l u t i o n To The g i v e n eq .= ) Example 17.12 17.12.sci 114
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
A=[0 1; 6 5] B= [ 0 ; 1 ] x=[1;0] disp ( x , x ( t ) = ) s=p o l y ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e o f a matrix A m eye (Row, Col )A // s I A =s n=d e t (m) //To Find The Determinant o f s i A p=i n v (m) ; // To Find The I n v e r s e Of s I A syms t s m; d i s p ( p , p hi ( s )= ) // R e s o l v e n t Matrix f o r i =1:Row f o r j =1: Col // I n v e r s e L a p l a c e o f each element o f Matrix ( p hi ( s ) ) q ( i , j )=i l a p l a c e ( p ( i , j ) , s , t ) ; end ; end ; d i s p ( q , p h i ( t )= ) // S t a t e T r a n s i t i o n Matrix t =(t ; m) q=e v a l ( q ) //At t=t , e v a l u a t i n g q i . e p hi ( t m m) // I n t e g r a t e q w. r . t m( I n d e f i n i t e I n t e g r a t i o n ) r=i n t e g ( qB,m) m=0 // Upper l i m i t i s t g=e v a l ( r ) // P u t t i n g t h e v a l u e o f upper l i m i t i n q m =t // Lower Limit i s 0 h=e v a l ( r ) // P u t t i n g t he v a l u e o f l o w e r l i m i t i n q y=(hg ) ; d i s p ( y , y= ) p r i n t f ( x ( t )= p hi ( t ) x ( 0 ) + i n t e g ( ph i ( t B) w. r . t m m) from 0 t 0 t \n ) // x ( t )=ph i ( t ) x ( 0 )+i n t e g ( ph i ( t B) w. r . t m from 0 t 0 m) t y1=(qx )+y ; d i s p ( y1 , x ( t )= ) Example 17.13 17.13.sci
A=[3 0 ; 2 4 ] 115
2 3 4 5
6 7
8 9 10
i f determ ( Cc ) ==0; p r i n t f ( S i n c e t h e matrix i s S i n g u l a r , t he system i s not c o n t r o l l a b l e \n ) ; else ; p r i n t f ( The system i s c o n t r o l l a b l e \n ) end ; Example 17.14 17.14.sci
1 2 3 4 5 6
7 8
9 10 11
i f determ (O) ==0; p r i n t f ( S i n c e t h e matrix i s S i n g u l a r , t he system i s not O b s e rv a b l e \n ) ; else ; p r i n t f ( The system i s O bs e r v a b l e \n ) end ; Example 17.16 17.16.sci
1 2 3
s=%s ;
// C r e a t i n g cont time transfer function
4 5 6
116
s=%s ;
// C r e a t i n g cont time transfer function
1 2 3 4 5 6 7 8 9 10 11 12 13
14 15 16 17 18 19 20
A=[0 1; 3 4] x=[1;0]; disp ( x , x ( t ) = ) s=p o l y ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e o f a matrix m eye (Row, Col )A =s // s I A n=d e t (m) //To Find The Determinant o f s i A p=i n v (m) ; / / To Find The I n v e r s e Of s I A syms t s ; d i s p ( p , p hi ( s )= ) // R e s o l v e n t Matrix f o r i =1:Row f o r j =1: Col // Taking I n v e r s e L a p l a c e o f each element o f Matrix p h i ( s) q ( i , j )=i l a p l a c e ( p ( i , j ) , s , t ) ; end ; end ; d i s p ( q , p h i ( t )= ) // S t a t e T r a n s i t i o n Matrix r=i n v ( q ) ; r=s i m p l e ( r ) ; //To Find p hi ( t ) d i s p ( r , p h i ( t )= ) Example 17.19 17.19.sci
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
x=[0;0] disp ( x , x ( t ) = ) s=p o l y ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e o f a matrix A m eye (Row, Col )A // s I A =s n=d e t (m) //To Find The Determinant o f s i A p=i n v (m) ; // To Find The I n v e r s e Of s I A syms t s m; d i s p ( p , p hi ( s )= ) // R e s o l v e n t Matrix f o r i =1:Row f o r j =1: Col // Taking I n v e r s e L a p l a c e o f each element o f Matrix ( ph i ( s)) q ( i , j )=i l a p l a c e ( p ( i , j ) , s , t ) ; end ; end ; d i s p ( q , p h i ( t )= ) // S t a t e T r a n s i t i o n Matrix t =(t m) q=e v a l ( q ) //At t=t , e v a l u a t i n g q i . e p hi ( t m m) r=i n t e g ( qB,m) // I n t e g r a t e q w. r . t m ( I n d e f i n i t e Integration ) m=0 // Upper l i m i t i s t g=e v a l ( r ) // P u t t i n g t h e v a l u e o f upper l i m i t i n q m =t // Lower Limit i s 0 h=e v a l ( r ) // P u t t i n g t he v a l u e o f l o w e r l i m i t i n q y=(hg ) ; p r i n t f ( x ( t )= p hi ( t ) x ( 0 ) + i n t e g ( ph i ( t B) w. r . t m m) from 0 t 0 t \n ) // x ( t )=ph i ( t ) x ( 0 ) + i n t e g ( ph i ( t B) w. r . t m from 0 m) t0 t y1=(qx )+y ; d i s p ( y1 , x ( t )= ) y2=Cy1 ; d i s p ( y2 , Output Response= ) Example 17.20 17.20.sci
A=[0 1; 2 0 ] 118
2 3 4 5
6 7
8 9 10
i f determ ( Cc ) ==0; p r i n t f ( S i n c e t h e matrix i s S i n g u l a r , t he system i s not c o n t r o l l a b l e \n ) ; else ; p r i n t f ( The system i s c o n t r o l l a b l e \n ) end ; Example 17.21 17.21.sci
1 2 3 4 5 6
7 8
9 10 11
i f determ (O) ==0; p r i n t f ( S i n c e t h e matrix i s S i n g u l a r , t he system i s not O b s e rv a b l e \n ) ; else ; p r i n t f ( The system i s O bs e r v a b l e \n ) end ; Example 17.22 17.22.sci
1 2 3 4 5 6 7 8
i eee ( 2 ) A=[3 0 0 ; 0 1 1 ; 0 0 1] B= [ 0 ; 1 ; 0 ] s=poly ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e of m eye (Row, Col )A =s / / s I A n=det (m) / / To F i n d p=inv (m) ; / / To F i n d 119
matrix
The The
Determinant Inverse Of
of s I A
s i A
9 10
syms t s ; disp ( p , ph i ( s )= )
// R e s o l v e n t
Matrix
23 24 25 26 27 28 29
30
A=[2 0 ; 1 1] B= [ 0 ; 1 ] x=[0;0] disp ( x , x ( t ) = ) s=p o l y ( 0 , s ) ; [ Row Col ]= s i z e (A) // S i z e o f a matrix A m eye (Row, Col )A // s I A =s n=d e t (m) //To Find The Determinant o f s i A p=i n v (m) ; // To Find The I n v e r s e Of s I A syms t s m; d i s p ( p , p hi ( s )= ) // R e s o l v e n t Matrix t =(t m) q=e v a l ( q ) //At t=t , e v a l u a t i n g q i . e p hi ( t m m) // I n t e g r a t e q w. r . t m ( I n d e f i n i t e I n t e g r a t i o n ) r=i n t e g ( qB,m) m=0 // Upper l i m i t i s t g=e v a l ( r ) // P u t t i n g t h e v a l u e o f upper l i m i t i n q m =t // Lower Limit i s 0 h=e v a l ( r ) // P u t t i n g t he v a l u e o f l o w e r l i m i t i n q y=(hg ) ; d i s p ( y , y= ) p r i n t f ( x ( t )= p hi ( t ) x ( 0 ) + i n t e g ( ph i ( t B) w. r . t m m) from 0 t 0 t \n ) // x ( t )=ph i ( t ) x ( 0 )+i n t e g ( ph i ( t B)w. r . t m from 0 t 0 t m) y1=(qx )+y ; d i s p ( y1 , x ( t )= ) // CONTROLABILITY OF THE SYSTEM Cc=cont mat (A, B) ; d i s p ( Cc , C o n t r o l a b i l i t y Matrix= ) //To Check Whether t h e matrix ( Cc ) i s s i n g u l a r i . e d e t e r m i n t o f Cc=0 i f determ ( Cc ) ==0;
120
31
32 33 34
121
18.1
Scilab Code
Example F3 ztransfer.sce
1 2 3 4
1 2 3 4 5 6 7
syms n z ; x=( 0.5) n y = ( 4 ( ( 0 . 2 ) n ) ) f 1=symsum ( x ( z(n ) ) , n , 0 , %inf ) f 2=symsum ( y ( z(n ) ) , n , 0 , %inf ) y=( f 1+f 2 ) ; disp ( y , ans= ) Example 18.08 18.08.01.sci
122
1 2 3 4
123