Sei sulla pagina 1di 12

WiSe 2015/2016

Exercises from

Scientic Pr.: Control System Toolbox I

Page 1

The following exercises are supposed to be solved with MATLAB. Students who do not
have their own license of the software may use of the computers in the Retina Pool.If you
do not have a Retina account yet obtain one at the following link:
http://www.retina.e-technik.tu-dortmund.de/cms/de/Account/index.html

Hint: visit http://www.mathworks.de/products/matlab/examples.html to watch online


demos from dierent MATLAB functions.

Reminder: all MANDATORY exercises have to be completed and PRESENTED during

the class. It is your obligation to notify the teaching assistant once you completed the
code and to present it to him. The code has to shown during the class, later submissions
by email or in person are not accepted.
The Control System Toolbox provides algorithms and tools for the systematic analysis,
design and tuning of linear control systems. It accepts models of linear time invariant
systems in terms of
transfer functions
state-space models
pole-zero-gain models,
frequency-response models

There are interactive tools and command-line functions for the visualization in both time and frequency domains. You can tune compensator parameters using automatic PID
controller tuning, Bode loop shaping, root locus method, LQR/LQG design, and other
interactive and automated techniques. You can validate your design by verifying rise time,
overshoot, settling time, gain and phase margins, and other requirements.
It is assumed that you have a profound background in system theory, in particular knowledge about representations of linear time invariant systems, feedback control design and
analysis in the time and frequency domain. This background knowledge is provided in the
course control theory of the program.

Exercise 1 :
Representations of LTI systems
Linear time-invariant system is a branch of applied mathematics and provides the mathematical foundation for engineering applications such as signal processing and control
system design. It investigates the response of a linear and time-invariant system to an
arbitrary input signal. Examples of LTI systems are electrical circuits composed of resistors, capacitors, and inductors or mechanical systems composed of inertia/mass, damping
(friction) and springs.

WiSe 2015/2016

Exercises from

Scientic Pr.: Control System Toolbox I

Page 2

The superposition principle (linearity property) means that the relationship between the
input and the output of the system is a linear map. If input x1 (t), generates the response
y1 (t), and input x2 (t) generates y2 (t) then the scaled and summed input a1 x1 (t) + a2 x2 (t),
produces the scaled and summed response a1 y1 (t) + a2 y2 (t).
Time invariance refers to the fact that an input applied to the system at T = 0 or at a
later instance T = T produces the identical output merely delayed by T . That is, if
the output due to input x(t) is y(t), then the output due to input x(t T ) is y(t T ). In
other words the output does not depend on the particular time the input is applied.
Any LTI system is characterized completely by the systems impulse response. The output
of the system for an arbitrary input is obtained by the convolution of the input signal with
the systems impulse response. This type of analysis is denoted as the the time domain
point-of-view. An LTI system can be analyzed in the frequency domain in terms of its
transfer function, which is the Laplace transform of the systems impulse response. The
output of the system in the frequency domain is given by the product of the transfer
function and the transform of the input. In other words, convolution in the time domain
is equivalent to multiplication in the frequency domain.
The Control System Toolbox utilizes the following model representations in the time and
frequency domain for linear time invariant systems:
state-space models
transfer function
zero pole gain models
frequency response data models

State space models


A state-space representation models a dynamic system as a set of input, output and state
variables related by rst-order dierential equations. The term state space refers to the
space spanned by the state variables xi , merged into a state vector x = (x1 , . . . , xn ). If
the continuous dynamical system is linear, time-invariant, and nite-dimensional, then
the dierential and algebraic equations that form the state space model may be written
in matrix form:
x = Ax + Bu
y = Cx + Du

(1)
(2)

where the state matrix A, the input matrix B , the output matrix C , and the feedthrough
D are matrices of appropriate dimensions, x is the state vector, and u and y are the input

WiSe 2015/2016

Exercises from

Scientic Pr.: Control System Toolbox I

Page 3

Bild 1: State space model : http://commons.wikimedia.org/wiki/File:Typical_


State_Space_model.png

and output vectors. The gure 1 shows the block diagram representation of the underlying
linear state space dierential and algebraic equations.
In case of SISO (single input, single output) systems the state space model becomes
x = Ax + bu
y = c0 x + du

(3)
(4)

where A is the n n-system matrix, b and c are n 1 input and output vectors and d is
a scalar. In the remainder of this tutorial we only consider SISO systems.
The following commands will be used in the next sections:

ss: creates a state-space model, or converts other dynamic system models to state-

step: generates the step response of a dynamic system. For the state space case,

space model: sys = ss(a,b,c,d) where a,b,c,d are the system, input, output and
the feed-through scalars respectively.
zero initial state is assumed. When it is invoked with no output arguments, step
plots the step response on the screen.

lsim: simulates the (time) response of continuous or discrete linear systems to arbi-

trary inputs. When invoked without left-hand arguments, lsim plots the response
on the screen.
lsim(sys,u,t) produces a plot of the time response of the dynamic system model
sys to the input time history t,u. The vector t species the N time samples for
the simulation. The vector u is N xM , where M is the number of system inputs.
lsim(sys,u,t,x0) further species an initial condition x0 for the system states.

gensig: generates customized input signals for the system. it supports the signal
forms sine wave ('sin'), square wave ('square') and periodic pulse ('pulse').

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 4

[u,t]=gensig(type,tau,Tf,Ts)

here, Tf:time duration of the signal, Ts: the spacing between the time samples t.

linearSystemAnalyzer: linearSystemAnalyzer(sys1): interactive user interface


for analyzing the time and frequency responses of linear systems and comparing
such systems. The app linearSystemAnalyzer replaces the GUI ltiview in older
versions of Matlab.

1) mandatory: Generate a state space model for a rst order linear system. A P T1
element is a proportional transfer element with a rst order delay described by the
dierential equation.
T x + x = Ku
(5)
characterized by the static gain K and the delay time constant T . Transform the
above equation into state space form
(6)
(7)

x = ax + bu
y = x

in that you compute a, b, c and d in 7 in terms of the parameters K and T from


Eq. (5).
a b c d

Generate the corresponding LTI system syspt1 for the specic parameters K = 1
and T = 2.
2) mandatory: Use linearSystemAnalyzer to analyze the LTI system syspt1 and
plot its step response, impulse response and bode diagram.
3) mandatory: The step response of a system in a given initial state consists of the
time evolution of its outputs when its control inputs are Heaviside (unit) step functions. In control theory, step response is the time behavior of the outputs of a general
system when its inputs change from zero to one in a very short time.
Plot the step response of syspt1 from the command line with step.
4) mandatory: Generate an LTI system syspt2 for the second order state space model
dened by


A =
b =
c =
d =

1 2
1 1
 
1
0
(0 1)
0

(8)
(9)
(10)
(11)

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 5

5) mandatory: Stability and natural response characteristics of a continuous-time


LTI system can be analyzed from the eigenvalues of the matrix A. The characteristic
polynomial is obtained from the determinant of the matrix sI A. The poles coincide
with the eigenvalues of the matrix A and their location in the left or right half
complex plane determines whether the system is unstable, asymptotically stable or
marginally stable.
Compute the eigenvalues si of the system matrix A.
s1

s2

What can you infer about the stability of the system?


6) mandatory: Plot the step response of the second order LTI system syspt2.
7) mandatory: Plot the system response for the LTI system syspt2 over the interval
t [0, 10] with a sample rate t = 0.1 for the following initial states and input
signals.
x0 =
x0 =

1
0

0
0

, u(t) = 0 (eigen motion)


, u(t) = sin(t)

WiSe 2015/2016

Exercises from

Scientic Pr.: Control System Toolbox I

Page 6

Transfer functions and Zero-Pole-Gain models


A transfer function represents the relation between the input and output of a linear timeinvariant system with zero initial conditions and zero-point equilibrium. For continuoustime input signals x(t) and output y(t), the transfer function H(s) is the linear mapping
of the Laplace transform of the input, X(s) = L{x(t)}, to the Laplace transform of the
output Y (s) = L{y(t)}:
(12)

Y (s) = H(s)X(s)

or
H(s) =

L{y(t)}
Y (s)
=
X(s)
L{x(t)}

(13)

where the Laplace transform of x(t) is


Z

X(s) = L{x(t)} =

x(t)est dt

(14)

A transfer function is dened by the nominator and denominator polynomial, where the
roots of the nominator correspond to the zeros of the LTI system and the roots of the
denominator to its poles. Example:
G(s) =

s+2
s2 + s + 10

(15)

An alternative representation is the specication in terms of zeros s0,i , poles sinf,i and
static gain k.
G(s) = k

(s s0,1 ) . . . (s s0,m )
(s s,1 ) . . . (s s,n )

(16)

The above transfer function has a unit gain k = 1, a zero at s0,1 = 2 and two conjugate
complex poles at sinf,{1,2} = 0.5 3.12i with a zero pole gain representation
G(s) =

(s 2)
(s + 0.5 3.12i)(s + 0.5 + 3.12i)

(17)

The following commands will be used:

tf : sys = tf(num,den) creates a continuous-time transfer function with numera-

tor(s) and denominator(s) specied by num and den. The coecients of the numerator and denominator polynomial are provided as a vector, e.g. the polynomial
s3 + 3s + 2 is dened by the vector [1 3 2].

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 7

zpk: sys = zpk(Z,P,K) creates a continuous-time zero-pole-gain (zpk) model sys


with zeros Z, poles P, and gains K. SYS is an object of class @zpk.

8) mandatory: Generate an LTI system with the Matlab function tf for the second
order SISO transfer function
G(s) =

K
s2
02

2
s
0

+1

(18)

with parameters K = 1, = 0.25 and 0 = 1.


9) mandatory: note: in case of transfer function models you can not provide an initial
state x0 for the simulation with lsim.
Plot the system response for the LTI system over the interval t [0, 10] with a
sample rate t = 0.1 for the input signals u(t) = cos(t)
10) mandatory:
- Convert the second order system described by the transfer function in Eq. (18)
to a state space representation with ss.
- Denote the system matrix A, input vector b and output vector c.
: the state-space representation is better suited for numerical computations,
such as simulation of the system, in particular it allows the specication of an initial state x0 .
Note

11) mandatory: Convert the state space model in Eq. (11) into a zero-pole-gain representation with zpk. Denote the poles s,1 , s,2 .
s,1 =
s,2 =

(19)
(20)

WiSe 2015/2016

Exercises from

Scientic Pr.: Control System Toolbox I

Page 8

Frequency response models

Frequency response models (frd) store, manipulate, and analyze frequency response data. An frd model stores a vector of frequency points with the corresponding complex
frequency response data you obtain either through simulations or experimentally.

frd: sys = frd(R,Freqs) creates an frd model SYS with response data R specied

bode:bode(sys) creates a Bode plot of the frequency response of a dynamic system

at the frequency points in Freqs. The output sys is an object of class @frd.

model sys.

12) optional: the frequency response data in AnalyzerData.mat provided from Matlab. The variables freq and resp contain 256 test frequencies and the corresponding
complex-valued frequency response points, respectively.
Generate a frequency response model from the data with and generate its Bode plot

System identication
System identication uses statistical methods to estimate mathematical models of dynamical systems from experimental data. The purpose of system identication is to generate
models of dynamic systems which structure and/or parameters are dicult to derive from
rst principles. Parameter identication employs time-domain and/or frequency-domain
input-output data to identify transfer functions and state-space models.
The system identication toolbox enables you to identify the parameters and structure
of linear and nonlinear models from experimental data in the time or frequency domain.
A complete coverage of the system identication toolbox is beyond the scope of this
assignment.
The following commands will be utilized:

ssest: sys = ssest(data,nx), estimates a state-space model using time or frequen-

cy domain data.
data is either an iddata object containing input and output signals in the time
domain or a frequency response model (frd) containing recorded frequency data.
The optional parameter nx denotes the order of the state space model.

13) optional: Identify a third order state space model from the frequency response
model in the previous assignment with ssest.

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 9

14) optional: Generate the step response for the identied model.
15) optional: Superimpose the Bode plot of the identied model with the original
frequency response of the frd model.

Model characteristics
The Control System Toolbox provides commands to query model characteristics such as
the I/O dimensions, poles, zeros, and DC gain. A pole zero plot is a graphical representation of a rational transfer function in the complex plane which conveys fundamental
properties of an LTI system such as stability, causal system / anticausal system, region
of convergence (ROC), minimum phase / non minimum phase.
16) mandatory: Determine the poles pole, zeros zero and static gain dcgain of the
LTI system described by the transfer function
H(s) =

s2

4s + 2
+ 5.5s + 9

.
17) mandatory: Plot the pole zero map of the system with pzmap.

(21)

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 10

Exercise 2 :
Interconnecting linear systems
You can perform arithmetics on LTI models, such as addition, multiplication or concatenation. Addition performs a parallel interconnection in terms of superposition of parallel
signals, multiplication performs a serial interconnection in that the output of the rst LTI
becomes the input to the second LTI.
The following command enable interconnections of LTI systems:

series: sys = series(sys1,sys2), connects two model objects in series.

parallel: sys = parallel(sys1,sys2), connects two model objects in parallel.

feedback: sys = feedback(sys1,sys2), generates a model object sys for the negative feedback interconnection of model objects sys1 and sys2.

For an open loop system with transfer function G(s) the closed-loop transfer function
G(s)
with unit feedback becomes C(s) = 1+G(s)
For an open loop system with transfer function G(s) the closed-loop transfer function
G(s)
.
with unit feedback transfer function H(s) becomes C(s) = 1+G(s)H(s)
1) mandatory: Assume an integrator with the transfer function
G1 (s) =

1
s

(1)

and a rst order system with


G2 (s) =

s+1
s+2

(2)

Compute the transfer function of the parallel and serial connection of the two systems.
2) mandatory: Assume an integrator with the transfer function
G(s) =

1
s

Compute the closed-loop transfer function for unit feedback.

(3)

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 11

3) mandatory: Assume an integrator with the transfer function


G(s) =

1
s

(4)

Compute the closed-loop transfer function for a feedback transfer function


H(s) =

s+1
s+2

(5)

Exercise 3 :
Analyzing Models
The Control System Toolbox allows you to analyze the time- and frequency-domain responses of one or more linear models using the LTI Viewer GUI. The LTI Viewer is a GUI
for viewing and manipulating the response plots of linear models. It displays the following
plot types for linear models:
Step and impulse responses (step, impulse)
Bode and Nyquist plots (bode, nyquist)
Nichols plots (nichols)
Singular values of the frequency response
Pole/zero plots (pzmap)
Response to a general input signal (lsim)
Unforced response starting from given initial states (only for state-space models)

(lsim)

The frequency response represents the response of a system to a stimulus. It is dened


in terms of the magnitude and phase of the output signal as a function of the frequency
of the input signal. In other words, if the system is stimulated with a sinusoidal input
signal the response of a linear system is a sinusoidal signal at that very same frequency
but with a modulated magnitude and phase relative to the stimulus. The magnitude of
the frequency response is measured on a logarithmic scale in decibels (dB) and the phase
measured in radians or degrees, versus the frequency in radians/sec or Hertz (Hz) of the
stimulus. The frequency response is plotted either as:
Bode (bode) : two separate plots of magnitude and phase versus input frequency

Exercises from

Scientic Pr.: Control System Toolbox I

WiSe 2015/2016

Page 12

Nyquist (nyquist) : magnitude and phase are visualized in a single polar plot with

frequency as a parameter

Nichols (nichols) : magnitude and phase are visualized in a single Cartesian plot

with frequency as a parameter

1) mandatory: Analyze the closed loop model of the second order system from the
previous assignment with the LTI viewer linearSystemAnalyzer.
G(s) =

s2

1
+s+1

(1)

Determine the following characteristic in the time domain by inspecting step response.
overshoot O =
settling time ts =
rise time tr =
steady state yinf =

Determine the following characteristics in the frequency domain by inspecting the


bode diagram
peak response Kpeak =
phase margin =
delay margin td =

What is the phase of the second order system for ?


2) mandatory: Convert the transfer function model
G(s) =

s2

1
+s+1

(2)

into state space form with ss.


The Matlab function lsim provides the same functionality regarding the simulation
of LTI systems as the LTI viewer. lsim not only plots the signals but also returns the
output signal y and the state signal x as arguments. With gensig you can generate
customized input signals for the system.
Analyze the response of the system to an initial displacement x0 = [0 2] for
u = 0 using lsim for t [0 25].
Analyze the response of the system for an initial state x0 = [0 0] and a sine
wave signal of period = 5s (generate the signal with gensig) using lsim.
Analyze the response of the system for an initial state x0 = [0 0] and a square
signal with period = 2s (generate the signal with gensig ) using lsim.

Potrebbero piacerti anche