state-space models 9 use of matlab - university of...

19
State-space models 9 use of MATLAB J A Rossiter 1 Slides by Anthony Rossiter

Upload: phamthien

Post on 05-May-2018

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

State-space models 9 use of MATLAB

J A Rossiter

1

Slides by Anthony Rossiter

Page 2: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Introduction

1. The previous videos have demonstrated numerous mechanisms for creating state space models to represent systems.

2. Matrix handling is not, in general, a paper and pen exercise, so this video gives a number of worked examples using the MATLAB tool for the number crunching.

3. Code is in the file statespace9.m

Slides by Anthony Rossiter

2

CxyBuAxx ;

Page 3: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

STATE SPACE OBJECTS IN MATLAB

Slides by Anthony Rossiter

3

Page 4: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

ss.m

MATLAB has a special format for storing state space systems.

Once in this format, the user can deploy a number of other MATLAB functions for system analysis and control design.

Slides by Anthony Rossiter

4

step.m impulse.m

pzmap.m feedback.m

bode.m nyquist.m

AND MORE!

See Use of MATLAB chapter for illustrations

Page 5: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

5

Examples using MATLAB real time

A=[1 2;3 2];

B=[1;0]; C=[1 -1];

D=0; G=ss(A,B,C,D)

A=[0 1 2;-1 3 0;0 2 0];

B=[1;0;-2]; C=[1 -1 0];

D=0; G=ss(A,B,C,D)

Page 6: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

6

A=[-1 0.1;0.2 -0.5]; B=[1;2]; C=[1 0];

D=0; G=ss(A,B,C,D)

step(G)

pzmap(G)

Gc=feedback(G,1)

-1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0-1

-0.5

0

0.5

1Pole-Zero Map

Real Axis (seconds-1)

Imagin

ary

Axis

(seconds

-1)

0 5 10 15 200

0.5

1

1.5Step Response

Time (seconds)

Am

plit

ude

Page 7: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

TRANSFER FUNCTION TO STATE SPACE

Slides by Anthony Rossiter

7

)(

)(

)()( sU

sd

snsY

Cxy

BuAxx

Page 8: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

8

Examples transfer function

parameters to state space parameters

n=[1 2];

d=[1 4 -2]; [A,B,C,D]=tf2ss(n,d)

n=[-9 0 2];

d=[1 3 2 -2]; [A,B,C,D]=tf2ss(n,d)

Page 9: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

STATE SPACE TO TRANSFER FUNCTION NOTE: THIS IS DONE FOR SISO ONLY AS ONE NEEDS MORE CARE FOR MIM0 PROCESSES AND THAT DETAIL IS BEYOND THIS VIDEO SERIES

Slides by Anthony Rossiter

9

)(

)(

)()( sU

sd

snsY

Cxy

BuAxx

Page 10: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

10

Examples state space to transfer

function

A=[1 2;3 2]; B=[1;0];C=[1 -1]; D=0; [n,d]=ss2tf(A,B,C,D,1)

A=[0 1 2;-1 3 0;0 2 0];

B=[1;0;-2];C=[1 -1 0]; D=0; [n,d]=ss2tf(A,B,C,D,1)

Page 11: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

SIMILARITY TRANSFORM: INVARIANCE OF BEHAVIOUR AND EIGENVALUES

Slides by Anthony Rossiter

11

Txz

zCTy

uTBzTATz

Cxy

BuAxx

C

BA

ˆ

1

ˆˆ

1

CCTBTBATAT ˆ;ˆ;ˆ 11

Page 12: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

12

Similarity transform and

behaviour A=[-1 0 0.2;-1 -3 0;0 0.1 -0.5];

B=[1;0;-2];C=[1 -1 0]; D=0; T=[2 1 1;0 1 -1; -3 0 2];

Ti=inv(T); Ahat=T*A*Ti;

Bhat=T*B;Chat=C*Ti; G=ss(A,B,C,D);

Ghat=ss(Ahat,Bhat,Chat,D); [y,t]=step(G);

[yhat]=step(Ghat,t); plot(t,y,'r',t,yhat,'o');

0 2 4 6 8 10 12 140

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

Page 13: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

DIAGONAL CANONICAL FORM

Slides by Anthony Rossiter

13

zCWyuBWzAWWzCBA ˆˆ

1

ˆ

1 ;

1;; WWACxyBuAxx

Page 14: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

14

Examples eigenvalue/

vector decomposition

A=[-1 0 0.2;-1 -3 0;0 0.1 -0.5];

[W,lambda]=eig(A); Ahat=inv(W)*A*W

lambda

Page 15: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

USING MATLAB TO FIND TRANSFORMATIONS WHICH GIVE CANONICAL FORMS

The key command is canon.m

Slides by Anthony Rossiter

15

Page 16: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

16

For transformation z = Tx to be

determined.

Page 17: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Slides by Anthony Rossiter

17

For transformation z = Tx to be

determined.

Companion form where the characteristic

polynomial appears in the rightmost column.

Page 18: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

Summary

Demonstrated the use of MATLAB for definition and analysis of state space systems.

Easy to plot behaviours, form closed-loop systems, find poles, do state transformations, etc.

Slides by Anthony Rossiter

18

Page 19: State-space models 9 use of MATLAB - University of …controleducation.group.shef.ac.uk/statespace/state space 9 - use of...Introduction 1. The previous videos ... numerous mechanisms

© 2016 University of Sheffield This work is licensed under the Creative Commons Attribution 2.0 UK: England & Wales Licence. To view a copy of this licence, visit http://creativecommons.org/licenses/by/2.0/uk/ or send a letter to: Creative Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA. It should be noted that some of the materials contained within this resource are subject to third party rights and any copyright notices must remain with these materials in the event of reuse or repurposing. If there are third party images within the resource please do not remove or alter any of the copyright notices or website details shown below the image. (Please list details of the third party rights contained within this work. If you include your institutions logo on the cover please include reference to the fact that it is a trade mark and all copyright in that image is reserved.)

Anthony Rossiter Department of Automatic Control and

Systems Engineering University of Sheffield www.shef.ac.uk/acse