0% found this document useful (0 votes)
75 views

Control Systems and Simulation - Prof - Kiran Babu

This document is a Scilab manual for control systems and simulation created by Prof. Kiran Babu of Vignan's Institute of Technology & Aeronautical Engineering. It contains 3 chapters that provide Scilab code solutions for linear system analysis, stability analysis using Bode, root locus and Nyquist plots, and verifying a state space model from a classical transfer function. The manual contains code examples, figures and explanations for each experiment.

Uploaded by

Wendy Brassard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Control Systems and Simulation - Prof - Kiran Babu

This document is a Scilab manual for control systems and simulation created by Prof. Kiran Babu of Vignan's Institute of Technology & Aeronautical Engineering. It contains 3 chapters that provide Scilab code solutions for linear system analysis, stability analysis using Bode, root locus and Nyquist plots, and verifying a state space model from a classical transfer function. The manual contains code examples, figures and explanations for each experiment.

Uploaded by

Wendy Brassard
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Scilab Manual for

Control Systems and Simulation


by Prof Kiran Babu
Electrical Engineering
Vignan’s Institute of Technology &
Aeronautical Engg.1

Solutions provided by
Prof Kiran Babu
Electrical Engineering
Vignan’sInstituteOfTechnologyAndAeronauticalEngg.

November 16, 2018

1 Funded by a grant from the National Mission on Education through ICT,


http://spoken-tutorial.org/NMEICT-Intro. This Scilab Manual and Scilab codes
written in it can be downloaded from the ”Migrated Labs” section at the website
http://scilab.in
1
Contents

List of Scilab Solutions 3

1 Linear System Analysis (Time domain analysis, Error anal-


ysis) 5

2 Stability analysis (Bode, Root Locus, Nyquist) of Linear


Time Invariant System 8

3 State space model for classical transfer function - Verifica-


tion 11

2
List of Experiments

Solution 1.1 Linear System Analysis . . . . . . . . . . . . . . . 5


Solution 2.2 Stability Analysis . . . . . . . . . . . . . . . . . . 8
Solution 3.3 Statespace model for Classical transfer function . 11

3
List of Figures

1.1 Linear System Analysis . . . . . . . . . . . . . . . . . . . . . 7

2.1 Stability Analysis . . . . . . . . . . . . . . . . . . . . . . . . 9

4
Experiment: 1

Linear System Analysis (Time


domain analysis, Error
analysis)

Scilab code Solution 1.1 Linear System Analysis

1 // C r e a t e d u s i n g Ubuntu 1 4 . 0 4 and S c i l a b 5 . 5 . 0
2 // Time Domain A n a l y s i s
3 clear
4 num = poly ([12.811 18 6.3223] , ” s ” ,” c o e f f ” ) ; //
D e f i n e s the numerator o f the t r a n s f e r f u n c t i o n
5 den = poly ([12.811 18 11.3223 6 1] , ” s ” ,” c o e f f ” ) ; //
Defines the denominator of the t r a n s f e r f u n c t i o n
6 sl = syslin ( ’ c ’ ,num , den ) ; //
Defines the t r a n s f e r function
7 t =[0:0.001:25]; // The
t i m e o f s i m u l a t i o n i s s e t from 0 t o 25 s e c o n d s
8 plot2d (t , csim ( ’ s t e p ’ ,t , sl ) ) // I t
p l o t s the step response of the t r a n s f e r function
sl
9 xgrid (5 ,1 ,7)
10 xtitle ( ’ Time Domain A n a l y s i s ’ , ’ Time ( s e c ) ’ , ’ C ( t ) ’ )
11

5
12
13
14 // E r r o r A n a l y s i s
15 clear
16 clc
17 num = poly ([240 120] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
n u m e r a t o r o f G( s )
18 den = poly ([12 7 1] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
d e n o m i n a t o r o f G( s )
19 G = num / den ; // D e f i n e s G( s )
20 Ess =1/(1+ horner (G ,0) ) ; // E v a l u a t e s S t e a d y
state error for step input
21 mprintf ( ’ The s t e a d y s t a t e e r r o r i s ’ )
22 disp ( Ess )

6
Figure 1.1: Linear System Analysis

7
Experiment: 2

Stability analysis (Bode, Root


Locus, Nyquist) of Linear Time
Invariant System

Scilab code Solution 2.2 Stability Analysis

1 // C r e a t e d u s i n g Ubuntu 1 4 . 0 4 and S c i l a b 5 . 5 . 0
2 // Bode P l o t
3 clear
4 num = poly ([9 1.8 9] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
n u m e r a t o r o f G( s )
5 den = poly ([0 9 1.2 1] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
d e n o m i n a t o r o f G( s )
6 sl = syslin ( ’ c ’ ,num , den ) ; // D e f i n e s G( s )
7 subplot (2 ,2 ,1)
8 bode ( sl ,0.01 ,100) // I t p l o t s t h e
Bode p l o t from 0 . 0 1 Hz t o 100 Hz
9
10
11 // Root L o c u s
12 clear

8
Figure 2.1: Stability Analysis

9
13 num =1; // D e f i n e s t h e
n u m e r a t o r o f G( s )
14 den = poly ([0 -1 -2] , ” s ” ,” r o o t s ” ) ; // D e f i n e s t h e
d e n o m i n a t o r o f G( s )
15 sl = syslin ( ’ c ’ ,num , den ) ; // D e f i n e s G( s )
16 subplot (2 ,2 ,2)
17 evans ( sl ,100) // P l o t s t h e r o o t
l o c u s f o r a maximum g a i n o f 100
18 sgrid ()
19
20
21 // N y q u i s t P l o t
22 clear
23 num = poly ([0.5 1] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
n u m e r a t o r o f G( s )
24 den = poly ([1 0 1 1] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
d e n o m i n a t o r o f G( s )
25 sl = syslin ( ’ c ’ ,num , den ) ; // D e f i n e s G( s )
26 subplot (2 ,2 ,3)
27 nyquist ( sl ) // P l o t s t h e N y q u i s t
p l o t f o r G( s )

10
Experiment: 3

State space model for classical


transfer function - Verification

Scilab code Solution 3.3 Statespace model for Classical transfer function

1 // C r e a t e d u s i n g Ubuntu 1 4 . 0 4 and S c i l a b 5 . 5 . 0
2 clear
3 clc
4 num = poly ([10 10] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
numerator o f the t r a n s f e r f u n c t i o n
5 den = poly ([10 5 6 1] , ” s ” ,” c o e f f ” ) ; // D e f i n e s t h e
denominator of the t r a n s f e r f u n c t i o n
6 sl = syslin ( ’ c ’ ,num , den ) ; // D e f i n e s t h e
transfer function
7 sys = tf2ss ( sl ) ; // C o n v e r t s
t r a n s f e r f u n c t i o n t o s p a c e model and s t o r e s t h e
r e s u l t in ” sys ”
8 disp ( sys )

11

You might also like