Description
Main concepts of this lab
■ How to numerically integrate a nonlinear (time-varying) ODEs.
■ How to plot solutions of dynamical systems.
■ How to symbolically linearize a nonlinear ODE.
■ How to transition from a symbolic vector field to numerical simulation.
■ How to define state space and transfer function representations of LTI systems in Matlab, and how to
convert representations.
■ How to numerically assess stability of an LTI system.
■ How to stabilize an LTI system using transfer function methods.
1 Introduction
In this lab we consider the crane depicted below, modelled as a pendulum with movable massless base.
g
t
M
l
u
An actuator at the pivot point of the pendulum imparts a force u, the control input. The mathematical
1
model, using the variables depicted in the figure, is
¨θ = −
g
l
sin(θ) −
1
Ml cos(θ)u.
Letting the output y be the angle of the pendulum, and the state x be given by
x =
”
θ
˙θ
#
,
a state space model is
x˙1 = x2
x˙2 = −
g
l
sin(x1) −
1
Ml cos(x1)u
y = x1.
(1)
This model is nonlinear. In Chapter 3 of the textbook, we linearized this model at the equilibrium
x¯ =
0 0⊤ with control u¯ = 0, and obtained the LTI model
x˙ =
”
0 1
−g/l 0
#
x +
”
0
−1/(Ml)
#
u
y =
h
1 0i
x,
(2)
approximating the behaviour of the pendulum near its lower position and at low speeds. In this lab,
you will numerically solve the equations of motion of the pendulum in (1), and symbolically linearize
them about an equilibrium to recover the linearization in (2). You will then evaluate the extent to which
solutions of the linearized pendulum (2) approximate solutions of the nonlinear pendulum (1). Finally,
you will design a simple controller for the linearization, and test it on the nonlinear system.
Throughout the lab, you will be guided through a number of steps which will require you to write
Matlab code. You will write your code in a Matlab script called labx.m, where x is the lab number. You
will submit this code as a group. Your code should provide certain outputs (figures, numbers, and the
like). A request for output is highlighted with a shaded area of text, such as the following.
Output 1. Print the eigenvalues of the matrix.
Parts of the text containing directions for the writing of your Matlab code will be highlighted in a
different colour, such as this:
Create a function pendulum.m. The first line of the function will be
function xdot = pendulum(t,x,parameters)
2