Sanjeev Presentation

Preview:

Citation preview

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 1/45

By-Sanjeev 1

MATHEMATICAL

MODELLING& VARIOUSCONTROL SYSTEM MODELS &RESPONSES USING MATLAB

By-Sanjeev

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 2/45

By-Sanjeev 2

Presentation Overview

Control Toolbox Introduction

Building Models for LTI System Continuous Time Models

Discrete Time Models

Combining Models

Transient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 3/45

By-Sanjeev 3

Control System Toolbox

This is a toolbox for control system designand analysis. It supports transfer function andstate-space forms (continuous/ discrete time,

frequency domain), as well as functions forstep, impulse, and arbitrary input responses.Functions for Bode, Nyquist,root-locus plots &

many control system designs are included.

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 4/45

By-Sanjeev 4

Building Models for LTI System

Control System Toolbox supportscontinuous time models and discrete timemodels of the following types*:

Transfer Function

Zero-pole-gain

State Space

* Material taken from http://techteach.no/publications/control_system_toolbox/#c1

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 5/45

By-Sanjeev 5

Continuous Time Transfer Function(1)

Function: Use tf function create transfer function

of following form:

Example 23

12

)( 2

ss

s

s H 

>>num = [2 1];

>>den = [1 3 2];

>>H=tf(num,den)

Transfer function:2 s + 1

-------------

s^2 + 3 s + 2

Matlab Output

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 6/45

By-Sanjeev 6

Continuous Time Transfer Function(2)

Include delay to continuous time Transfer Function

Example23

12)(

2

2

ss

ses H 

s

 

Transfer function:

2 s + 1

exp(-2*s) * -------------

s^2 + 3 s + 2

>>num = [2 1];

>>den = [1 3 2];

>>H=tf(num,den,’inputdelay’,2) 

Matlab Output

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 7/45

By-Sanjeev 7

Continuous Time Transfer Function(3)

Function: Use zpk function to create transferfunction of following form:

Example 21

5.02

23

12)(

2

ss

s

ss

ss H 

>>num = [-0.5];

>>den = [-1 -2];>>k = 2;

>>H=zpk(num,den,k)

Zero/pole/gain:2 (s+0.5)

-----------

(s+1) (s+2)

Matlab Output

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 8/45

By-Sanjeev 8

Continuous Time State Space Models(1)

State Space Model for dynamic system

DuCxy

BuAxx

Matrices: A is state matrix; B is input matrix; C isoutput matrix; and D is direct

transmission matrixVectors: x is state vector; u is input vector; and y isoutput vector

Note: Only apply to system that is linear and time invariant

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 9/45

By-Sanjeev 9

Continuous Time State Space Models(2)

Function: Use ss function creates state spacemodels. For example:

0103

0

25

10

2

1

DCBAx  x

 x

>>A = [0 1;-5 -2];

>>B = [0;3];>>C = [0 1];

>>D = [0];

>>sys=ss(A,B,C,D)

a =

x1 x2x1 0 1

x2 -5 -2

Matlab Output

 b =

u1x1 0

x2 3

c =

x1 x2

y1 0 1

d =

u1

y1 0

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 10/45

By-Sanjeev 10

Conversion between different models

Converting From Converting to Matlab function

Transfer Function Zero-pole-gain [z,p,k]=tf2zp(num,den)

Transfer Function State Space [A,B,C,D]=tf2ss(num,den)

Zero-pole-gain Transfer Function [num,den]=zp2tf(z,p,k)

Zero-pole-gain State Space [A,B,C,D]=zp2ss(z,p,k)

State Space Transfer Function [num,den]=ss2tf(A,B,C,D)

State Space Zero-pole-gain [z,p,k]=ss2zp(A,B,C,D)

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 11/45

By-Sanjeev 11

 % Transfer function model

num = [0 0 25];den = [1 4 25];G = tf(num,den)

% Zero-Pole-Gain model[z,p,k]=tf2zp(num,den)% State-Space model

[A,B,C,D]=tf2ss(num,den)

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 12/45

By-Sanjeev 12

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining ModelsTransient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 13/45

By-Sanjeev 13

Discrete Time Transfer Function(1)

Function: Use tf function create transfer function

of following form:

Example: with sampling time 0.423

12

)( 2

 z z

 z z H 

>>num = [2 1];

>>den = [1 3 2];>>Ts=0.4;

>>H=tf(num,den,Ts)

Transfer function:

2 z + 1-------------

z^2 + 3 z + 2

Sampling time: 0.4

Matlab Output

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 14/45

By-Sanjeev 14

Discrete Time Transfer Function(2)

Function: Use zpk function to create transferfunction of following form:

Example: with sampling time 0.4 21

5.0

2)(

 z z

 z z H 

>>num = [-0.5];

>>den = [-1 -2];>>k = 2;

>>Ts=0.4;

>>H=zpk(num,den,k,Ts)

Zero/pole/gain:

2 (z+0.5)-----------

(z+1) (z+2)

Sampling time: 0.4

Matlab Output

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 15/45

By-Sanjeev 15

Discrete Time State Space Models(1)

State Space Model for dynamic system

][][][

][][]1[

nnn

nnn

DuCxy

BuAxx

Matrices: A is state matrix; B is input matrix; C isoutput matrix; and D is direct

transmission matrixVectors: x is state vector; u is input vector; and y isoutput vector

n is the discrete-time or time-index

Note: Only apply to system that is linear and time invariant

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 16/45

By-Sanjeev 16

Discrete Time State Space Models(2)

Function: Use ss function creates state spacemodels. For example:

010

3

0

25

10

][

][][

2

1

DCBAx

n x

n xn

>>A = [0 1;-5 -2];

>>B = [0;3];

>>C = [0 1];

>>D = [0];

>>Ts= [0.4];

>>sys=ss(A,B,C,D,Ts)

Transfer function:

2 z + 1

-------------

z^2 + 3 z + 2

Sampling time: 0.4

Matlab Output

a =

x1 x2

x1 0 1x2 -5 -2

Matlab Output

 b =

u1

x1 0x2 3

c =

x1 x2

y1 0 1

d =

u1

y1 0

Sampling time: 0.4

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 17/45

By-Sanjeev 17

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining ModelsTransient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 18/45

By-Sanjeev 18

Combining Models(1)

A model can be thought of as a block withinputs and outputs (block diagram) andcontaining a transfer function or a state-

space model inside itA symbol for the mathematical operations on

the input signal to the block that produces theoutput

TransferFunction

G(s) Input Output

Elements of a Block Diagram

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 19/45

By-Sanjeev 19

Combining Models(2)

The Following Matlab functions can be used toperform basic block diagram manipulation

Combination Matlab Command

sys = series(G1,G2) 

sys = parallel(G1,G2)

sys = feedback(G1,G2)

G 1(s)  G 2 (s) 

+G 1(s) 

G 2 (s) 

+

+G 1(s) -

G 2 (s) 

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 20/45

By-Sanjeev 20

Basic arithmetic operations of Models

Arithmetic Operations Matlab Code

Addition sys = G1+G2;

Multiplicationsys = G1*G2;

Inversionsys = inv(G1);

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 21/45

By-Sanjeev 21

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining ModelsTransient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 22/45

By-Sanjeev 22

Transient Response Analysis(1)

Transient response refers to the processgenerated in going from the initial state tothe final state

Transient responses are used toinvestigate the time domain characteristicsof dynamic systems

Common responses: step response,impulse response, and ramp response

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 23/45

By-Sanjeev 23

Transient Response Analysis(2)

Unit step response of the transfer function system

Consider the system: 254

252 ss

s H 

%*****Numerator & Denominator of H(s)

num = [0 0 25];den = [1 4 25];

%*****Specify the computing time

t=0:0.1:7;

sys=tf(num,den)

step(sys,t)

%*****Add grid

grid

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 24/45

By-Sanjeev 24

Transient Response Analysis(3)

Unit step response of H(s)

Unit Step Response of H(s)

Time (sec)

   A  m  p   l   i   t  u   d  e

0 1 2 3 4 5 6 70

0.2

0.4

0.6

0.8

1

1.2

1.4

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 25/45

By-Sanjeev 25

Transient Response Analysis(4)

Alternative way to generate Unit step responseof the transfer function, H(s)

If step input is , then step response isgenerated with the following command:

%*****Numerator & Denominator of H(s)

>>num = [0 0 25];den = [1 4 25];%*****Create Model

>>H=tf(num,den);

>>step(H)

>>step(10*H)

)(10 t u

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 26/45

By-Sanjeev 26

Transient Response Analysis(5)

Impulse response of the transfer function system

Consider the system: 254

252

ss

s H 

%*****Numerator & Denominator of H(s)

num = [0 0 25];

den = [1 4 25];

%*****Specify the computing time

t=0:0.1:7;

Sys=tf(num,den)

impulse(sys,t)

grid 

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 27/45

By-Sanjeev 27

Transient Response Analysis(6)

Impulse response of H(s)

Impulse Response of H(s)

Time (sec)

   A  m  p   l   i   t  u   d  e

0 1 2 3 4 5 6 7-1

-0.5

0

0.5

1

1.5

2

2.5

3

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 28/45

By-Sanjeev 28

Transient Response Analysis(7)

Ramp response of the transfer function system

There‟s no ramp function in Matlab 

To obtain ramp response of H(s), divide H(s) by

“s” and use step function

Consider the system:

For unit-ramp input, . Hence

254

252

ss

s H 

2

1)( ssU 

254

251

254

251222

 

  

 

ssssssssY 

Indicate Step response

NEW H(s)

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 29/45

By-Sanjeev 29

Transient Response Analysis(8)

Example: Matlab code for Unit Ramp Response

%*****Numerator & Denominator of NEW H(s)

num = [0 0 0 25];den = [1 4 25 0];%*****Specify the computing time

t=0:0.1:7;

sys=tf(num,den)

step(sys,t)

%*****Add grid & title of plot

grid

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 30/45

By-Sanjeev 30

Transient Response Analysis(9)

Unit Ramp response of H(s)

0 1 2 3 4 5 6 70

1

2

3

4

5

6

7Unit Ramp Response Curve of H(s)

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 31/45

By-Sanjeev 31

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining ModelsTransient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 32/45

By-Sanjeev 32

Frequency Response Analysis(1)

For Transient response analysis - hard todetermine accurate model (due to noise orlimited input signal size)

Alternative: Use frequency response approachto characterize how the system behaves in thefrequency domain

Can adjust the frequency responsecharacteristic of the system by tuning relevantparameters (design criteria) to obtain acceptabletransient response characteristics of the system

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 33/45

By-Sanjeev 33

Frequency Response Analysis(2)

Bode Diagram Representation of Frequency Response

 Consists of two graphs: 

Log-magnitude plot of the transfer function

Phase-angle plot (degree) of the transfer functionMatlab function is known as „bode‟ 

%*****Numerator & Denominator of H(s)

num = [0 0 25];den = [1 4 25];%*****Use „bode‟ function 

sys=tf(num,den)

bode(sys)

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 34/45

By-Sanjeev 34

Frequency Response Analysis(3)

Example: Bode Diagram for

Bode plot of H(s)

Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )

   M  a  g  n   i   t  u   d  e   (   d   B   )

-60

-50

-40

-30

-20

-10

0

10

20

100

101

102

-180

-135

-90

-45

0

254

252

ss

s H 

Bode magnitude plot 

Bode phase plot 

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 35/45

By-Sanjeev 35

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining Models

Transient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 36/45

By-Sanjeev 36

Stability Analysis Based on FrequencyResponse(1)

Stability analysis can also be performedusing a Nyquist plot

From Nyquist plot – determine if system is

stable and also the degree of stability of asystem

Using the information to determine how

stability may be improvedStability is determined based on the

Nyquist Stability Criterion

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 37/45

By-Sanjeev 37

Stability Analysis Based on FrequencyResponse(2)

Example: Matlab code to draw a Nyquist Plot

Consider the system 18.0

12

ss

s H 

%*****Numerator & Denominator of H(s)

num = [0 0 1];

den = [1 0.8 1]; 

%*****Draw Nyquist Plot

sys=tf(num,den)

nyquist(sys)

grid 

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 38/45

By-Sanjeev 38

Stability Analysis Based on FrequencyResponse(2)

The Nyquist Plot for

Nyquist plot of H(s)

Real Axis

   I  m  a  g   i  n  a  r  y   A  x   i  s

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

-1

-0.5

0

0.5

1

0 dB

-20 dB

-10 dB

-6 dB

-4 dB

-2 dB

20 dB

10 dB

6 dB

4 dB

2 dB

18.0

12

ss

s H 

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 39/45

By-Sanjeev 39

Lecture Overview

Building Models for LTI System

Continuous Time Models

Discrete Time Models

Combining Models

Transient Response Analysis

Frequency Response Analysis

Stability Analysis Based on FrequencyResponse

Other Information

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 40/45

By-Sanjeev 40

Other Information

Use help to find out more about theMatlab functions shown in this lecture

Check out Control System Toolbox forother Matlab functions

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 41/45

By-Sanjeev 41

ROOT LOCUS PLOT

Example: Matlab code to draw a Root Locus PlotConsider the system

18.0

1

2

sss H 

%*****Numerator & Denominator of H(s)num = [0 0 1];den = [1 0.8 1]; %*****Draw Root Locus Plot

sys=(num,den)rlocus(sys)grid

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 42/45

By-Sanjeev 42

Root locus plot

-0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1-4

-3

-2

-1

0

1

2

3

4

0.0950.130.19

0.3

0.55

0.5

1

1.5

2

2.5

3

3.5

0.5

1

1.5

2

2.5

3

3.5

0.0180.040.0650.0950.130.19

0.3

0.55

0.0180.040.065

Root Locus

Real Ax is

   I  m  a  g   i  n  a  r  y   A  x   i  s

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 43/45

By-Sanjeev 43

Procedure of Designing a Control System

System & Required Design Specifications Mathematical Model

Test the System

1. Fulfill the Required Design Specification ?• Transient Response Analysis• Frequency Response Analysis

2. How stable or robust ? Is your system stable?• Stability Analysis Based on Frequency Response

Are (1) & (2) satisfy?

end

YES

Revisit the designe.g. Combine model?

NO

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 44/45

By-Sanjeev 44

Transient response Specifications

Unit Step Response of G(s)

Time (sec)

     A    m    p     l     i     t   u     d

    e

0 0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1

1.2

1.4

Peak Time

Rise Time

Steady State

Settling Time

0.1

0.5

Delay Time

Mp

Unit Step Response of G(s)

Time (sec)

     A    m    p     l     i     t   u     d

    e

0 0.5 1 1.5 2 2.5 3

0.2

0.4

0.6

0.8

1

1.2

1.4

Peak Time

Rise Time

Steady State

Settling Time

0.1

0.5

Delay Time

Mp

8/3/2019 Sanjeev Presentation

http://slidepdf.com/reader/full/sanjeev-presentation 45/45

By-Sanjeev 45

Frequency Domain Characteristics

What is the bandwidth of the system?

What is the cutoff frequencies?

What is the cutoff rate? Is the system sensitive to disturbance?

How the system behave in frequency domain?