State-space models 9 use of MATLAB - University of...
Transcript of State-space models 9 use of MATLAB - University of...
State-space models 9 use of MATLAB
J A Rossiter
1
Slides by Anthony Rossiter
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 ;
STATE SPACE OBJECTS IN MATLAB
Slides by Anthony Rossiter
3
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
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)
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
TRANSFER FUNCTION TO STATE SPACE
Slides by Anthony Rossiter
7
)(
)(
)()( sU
sd
snsY
Cxy
BuAxx
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)
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
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)
SIMILARITY TRANSFORM: INVARIANCE OF BEHAVIOUR AND EIGENVALUES
Slides by Anthony Rossiter
11
Txz
zCTy
uTBzTATz
Cxy
BuAxx
C
BA
ˆ
1
ˆˆ
1
CCTBTBATAT ˆ;ˆ;ˆ 11
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
DIAGONAL CANONICAL FORM
Slides by Anthony Rossiter
13
zCWyuBWzAWWzCBA ˆˆ
1
ˆ
1 ;
1;; WWACxyBuAxx
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
USING MATLAB TO FIND TRANSFORMATIONS WHICH GIVE CANONICAL FORMS
The key command is canon.m
Slides by Anthony Rossiter
15
Slides by Anthony Rossiter
16
For transformation z = Tx to be
determined.
Slides by Anthony Rossiter
17
For transformation z = Tx to be
determined.
Companion form where the characteristic
polynomial appears in the rightmost column.
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
© 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