Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1 State-space equations
We have seen that high-order differential equations can be written in terms of a set of coupled first
order differential equations, and that these can be solved easily within the Simulink evironment. In
particular, when these equations are linear, they can be written in matrix-vector form which can be
represented by one state-space block in Simulink.
To be more specific, if we consider the (linear) state-space realisation,
(1)
(2)
it transpires that the state equation (1) has a solution of a very similar form to a simple scalar first-order
differential equation:
2
Note that the right hand side of this equation consists of two distinct parts: the first term which repre-
sents the free response of the system and is a function of the initial state of the system, x ; the second
term is the forced response of the system and is dependent on all inputs to the system applied over the
interval from to to . A similar, although less uniform, partition can be made for systems described
in nonlinear state-space form. Thus far we have made the assumption that the initial conditions of the
system have been zero, that is the state evolves over time purely as a function of its inputs. To some
extent there is some justification to this assumption: often when measurements are taken, we refer
them to a situation corresponding to the system at rest (i.e. zero initial conditions); also, it is often easy
to redefine the co-ordinates of a system so that, in the new set of co-ordinates, the initial conditions are
zero. However, in other cases, particularly cases where we are required to have an absolute value for
3 4265
the states/outputs of the system, this justification disappears. For example consider starting a particle
3 2785
moving from a nonzero initial position, say . Then the subsequent motion of the particle will
depend from where it was started i.e. . The same is true in many situations: assuming zero
initial conditions only gives part of the solution to our state, and hence output, equations.
It is also important to point out that when nonlinear systems are considered, the value of the initial con-
dition not only adjusts the off-set correctly, it plays an important role of determining the subsequent
behaviour of the system - the initial condition determines the initial dynamic behaviour of the system.
2 Simulink
As well as being able to caluculate the forced response of a system, Simulink is able to calculate the
free response of a system, and more importantly can combine these responses to obtain the complete
response of a system. There are two main ways the effect of initial conditions are accounted for in the
Simulink environment.
State-space block. Entering initial conditions requires one to have a vector of initial conditions (obvi-
ously of the same dimension as the state vector) and then to enter this vector in the block diagram by
double-clicking on the block and inserting the vector in the appropriate place. This is relatively easy,
but one must be careful about the order in which the initial conditions are entered in this vector - it
must be coincide with the order of states.
Integrator. This can be useful for initialising nonlinear equations, which cannot be built out of state-
space blocks. In a similar manner to the state-space block, one can double-click on the integrator block
and enter its initial condition in the appropriate place.
The procedure for simulating systems with non-zero initial conditions is otherwise excactly the same
as for the standard simulation procedure. It is frequently convenient, particularly when considering
large systems, to enter the initial conditions using a Matlab script.
3 Introduction to stability
The subject of stability is, by and large, beyond the scope of this course, although some basic ideas
of stability can be help to understand the dynamics of systems. Roughly speaking a system is termed
stable if it settles down to some equilibrium condition after a certain period of time, assuming zero
or constant input is applied. Converesly, it is described as unstable if its time history explodes or
diverges. Obviously there are cases which fall somewhere between these two extremes as well.
In detail:
A system is stable if all of the eigenvalues of have negative real parts (corresponds to a system
settling down).
A system is unstable if one or more of the eigenvalues of have positive real parts (there will
be exponential divergence of one or more of the systems states).
A system is marginally stable if all the eigenvalues of have negative real parts excepts at least
one which has zero real part (this situation can correspond to oscillators where all eigenvalues
have purely imaginary parts).
4 Example
Using the voltages across the capacitors as states and the voltage $ as the output, it can be shown that
state-space matrices for this system can be obtained as:
' (4)
(5)
It can be shown that the frequency of the oscillation in the Wien Bridge circuit is inversely proportional
to , that is for smaller value of , the frequency of oscillations increases.
Try changing the frequency of oscillation by reducing the value of to one tenth of its previous value.
Your simulation results should show you that the frequency of oscillations has indeed increased but that
the output graph is difficult to view. To rectify this try reducing the length of the simulation time in the
Simulation/Parameters/Solver tab. However, also notice that we are solving our differential equations
using the standard variable step solver which can sometimes be unreliable, particularly for systems
with fast time constants. Try changing the solver properties to Dormand-Price and make sure that the
solver deals with continuous variables. For the time step, choose something relatively small like $ .
There is a trade-off with the value of this time step: small time steps can ensure that the system is
simulated as accurately as possible - minimising the interpolation errors. However, the smaller the
time step, the longer it will take to simulate the system. To simulate a system for one second using a
$
time-step of requires 10 loops of the solver algorithm; to simulate the same length of time using
a time step of $ requires 1000 loops - an increase of a factor of 100. For small systems, such
as our Wien Bridge oscillator, this is not noticeable, but for larger, more realistic systems, the choice
of this time step can be important. As a general rule, the choice of the time step is determined by the
systems smallest time constant - the smaller the time constant the smaller the time step.
We have mainly been considering linear systems so far and the dynamics of these systems are not de-
pendent on the initial condition - the initial condition gives a reference point from which motion can be
measured and contributes to the complete response of the system, but it does not determine the initial
dynamics of the system. For nonlinear systems the initial dynamics of the system are set by the initial
condition. In the last exercise we considered a pendulum and found that for small angular displace-
ments the linear and nonlinear models were similar - but this assumed an initial angular displacement
of zero. Compare the responses of the linear and nonlinear models now assuming an initial angular
displacement of radians.