For more information, type help symbolic in Matlab. A tutorial demonstration is
available with
the command symintro.
The following notes represent a short introduction to the symbolic processing
capabilities of Matlab.
13.1 Symbolic Expressions and Algebr
a1
2
p
a0 + kpb0
and approaches 0 for large kp.
Thus we expect a faster but more oscillatory response as we increase kp. This is
illustrated in Figs 55 and 56 where we show the open and closed-loop responses
of
G(s) =
4
s2 + 5s + 4
with the proportional c
The aim of the controller is to determine the manipulated variable u(t) so that
the plant output yp(t) tracks the reference signal r(t) as closely as possible. The
controller takes a very specific structure
u = C(e)
e = P(r) ym
2.3 Standard control loop w
Bode plots depict the frequency response graphically. The first subplot
shows gain (in dB) against frequency (log scale). The second
sub-plot shows phase (linear scale) against frequency (log scale).
We have built a catalogue of first and second order r
D=
s^3+4*s^2+3*s
Thus, H(s) can be expressed in the form
H(s) = s + 2
s3 + 4s2 + 3s
As a second example, consider
G(s) = s+4+
2
s+4
+
3
s+2
Manipulating with Matlab:
254
> syms s
> G = s+4 + 2/(s+4) + 3/(s+2);
> [N,D] = numden(G)
N=
s^3+10*s^2+37*s+48
D=
_G.
Gigerenzer: Gut Feelings, Allen Lane, 2007.
1 INTRODUCTION 7
of water falling onto a mill wheel. Until very recently the same principle was
used for the control of Diesel engines.
flyball
valve
pivot
Figure 1: Watts governor.
The invention of the feed
1.1
(s+1)(s+1.1)
10
(s+1)(s+10)
1
s+1
Figure 31: Step responses for second order transfer functions with real poles
If p1 and p2 are similar, the response is significantly different from any
first order response.
5.3.2 The poles are identical and real
Su
dn1y
dtn1 (t) + + a1
dy
dt
(t) + a0y(t)
= bm
dmu
dtm (t) + bm1
dm1u
dtm1 (t) + + b1
du
dt
(t) + b0u(t) (2)
We say y = G(u) if, given an input signal u, the output signal y satisfies (2).
Linearity says that if, given u1 and u2, we have
y1 = G(u1)
and
y2 =
16 HH:MM PM 3:45 PM
17 QQ-YY Q1-96
18 QQ Q1
Examples:
> ds = datestr(d)
ds =
10-Jun-1998 10:30:13
> datestr(d,14)
ans =
10:30:13 AM
The function datenum is used to compute a date number. It has three forms:
datenum(s): Returns the date number correspondin
_
dx
dt
(t)
_
dx
dt
(0)
= s2X(s) sx(0)
dx
dt
(0)
4.3.3 Integration
Suppose
y(t) =
Zt
0
u(_)d_
Then
dy
dt
(t) = u(t) and y(0) = 0
It follows that
Y (s) =
1
s
U(s)
4.3.4 Delay
Suppose
y(t) = u(t _)
Then
Y (s) = L[u(t _)]
=
Z
0
u(t _)estdt
=
Z
_
u(t)es(t+_)
256
> syms s
> H = s^2 +6*s + 8;
> G = -H/3
G=
-1/3*s^2-2*s-8/3
The result is G = (1/3)s2 2s 8/3, while we would prefer G = (s2 + 6s + 8)/3.
13.2Manipulating Trigonometric Expressions
Trigonometric expressions can also be manipulated symbolically in Matla
=
s2 + a1s + a0
s2 + (a1 + kpTdb0)s + (a0 + kpb0)
The derivative action gives us an extra degree of freedom, that allows us
to choose the closed-loop natural frequency !n and the closed-loop damping _
independently. Specifically we can choose
kp =
!2n
a0
distance traveled: 144.6364 ft
242
String Functions
blanks(n) Returns a string of n blanks. Used with disp, eg. disp
([xxx blanks(20) yyy]). disp(blanks(n) moves
the cursor down n lines.
deblank(s) Removes trailing blanks from string s.
eval(s) Execute th
over an interval a x b. A local maximum or local minimum (one that does not
occur at one
of the boundaries x = a or x = b) can occur only at a critical point, which is a point
where either
df/dx = 0 or df/dx does not exist.
Example 13.2 Minimum cost tank
nonlinear control,
multivariable control,
switched control,
networked control,
state space models,
optimal control,
1 INTRODUCTION 10
modern robust control.
Similarly we will pay little attention to the important topics of system identification
and
tuning rules suggest PID gains kp = 4.8, Ti = 1.1 and Td = 0.56. Fig 65 shows
the outputs and inputs of the plant with a PID controller subject to an output
disturbance at t = 20, an output disturbance at t = 40 and a set point change at
t = 60. The dashe
Since the Matlab diff function returns only an approximate derivative, it is necessary
to use the
resolution required to achieve the accuracy desired.
Differentiation Error Sensitivity
Differentiation is sensitive to minor changes in the shape of a functi
25
30
35
s
s^3+4*s^27*s10
A(s)
Figure 13.1: Plot of a polynomial function using ezplot
13.4 Solving Algebraic and Transcendental Equations
The symbolic math toolbox can be used to solve algebraic and transcendental
equations, as well as
systems of such eq
x(t) =
1
2j
ej!t ej!t_
It follows from the Laplace transform of an exponential that
X(s) =
1
2j
_
1
s j!
1
s + j!
_
=
1
2j
2j!
s2 + !2
=
!
s2 + !2
4 LAPLACE TRANSFORMS AND TRANSFER FUNCTIONS 26
4.2.4 Dirac delta function
The Dirac delta function _(t) is
monitored via a SCADA (supervisory control and data acquisition).
Phosphoric Addition
Separator Separator
Caustic Addition
Degumming Tank
Heat Exchabger
Crude In
Steam
AV1
AV2 AV3
MV1 MV2
FI1
PI1 PI2
Soap and water phase
Refined Oil
S1 S2
Figure 5: Schema
Figure 38 shows the rise time against damping ratio for a second order
system with no zero when the natural frequency !n = 1. Two commonly
5 STEP RESPONSES 46
used approximations are also shown:
tr
2.16_ + 0.6
!n
tr
1.8
!n
Settling time. The settling ti
a non-negative integer smaller than 252 and b must be an integer
between 2and 36.
dec2base(d,b,N) Produces a representation with at least N digits.
Examples:
> a = dec2bin(18) % find binary representation of 18
a=
10010
> bin2dec(a) % convert a back to de
(or model with) G(s).
4.4.1 Definitions
We write
G(s) =
bmsm + bm1sm1 + b0
sn + an1sn1 + + a0
The order of G is n. The relative degree of G is n m. A transfer function is
said to be proper if n m and improper if n < m. We do not allow improper
transfer fu
The second derivative of a function f(x)is the derivative of the first derivative of the
function
f
_(xk) = df _(x)
dx
This function can be approximated using slopes of the first derivative. Using
backward differences
and assuming uniform spacing x
f
_(xk
G(s)C(s)
1 + G(s)C(s)
so that
Yp(s) = T (s)P(s)R(s) T (s)N(s) + G(s)S(s)Di(s) + S(s)Do(s)
As before we have the relations
T (s) = G(s)C(s)S(s)
and
S(s) + T (s) = 1
Suppose
G(s) =
n(s)
d(s)
and C(s) =
nc(s)
dc(s)
with n(s), d(s), nc(s) and dc(s) all polyno
> int(1/(1+x^2)
ans =
atan(x)
> int(exp(-x^2)
ans =
1/2*pi^(1/2)*erf(x)
The last integral above introduces the error function erf(x) for each element of x,
where x is real.
The error function is defined as:
erf(x) =
2
_
x
0
e
t2
dt
13.6 Linear Algebra
Ope