Date post: | 04-Jun-2018 |
Category: |
Documents |
Upload: | dhirendra-soni |
View: | 217 times |
Download: | 0 times |
of 21
8/13/2019 control system analysis-Lecture 1
1/21
EE250: Lecture Note 1
Linear Dynamical Systems
1 Introduction
In this course, we will learn about control systems. In this age of automation, controlsystems are all pervading from aircraft to washing machine, and from robotics to powersystems. Lets take an example of an automatic sprinkler system.
Automatic Sprinkler System
Figure 1 shows an automatic sprinkler system for watering a garden. There are manyelectrodes placed in the garden which provide information regarding the dryness of thesoil to a properly decision making system which either turns on the sprinkler or turns ofthe sprinkler.
Various operation of different sub-systems of the automatic sprinkler system as shownin Figure 1 are as follows.
1. The soil moisture is measured through sensors placed in the various parts of thegarden. These sensor data are used as feedback to the Controller.
2. A computer can work as the Controller which is a decision making process. You canalso use a micro-controller. This unit reads all sensor data and learns the averagemoisture contents of the soil. Based on a pre-decided threshold value, the controlleractuates an ON signal or OFF signal to the driver of the sprinkler which is usuallya pump unit. You all can write a simple code for this sub-system.
3. The actuator is the device that automatically powers the pump or turns off thepump. You need to design this subsystem using an electronic logic unit.
Figure 1: Automatic sprinkler system
1
8/13/2019 control system analysis-Lecture 1
2/21
4. The sprinkler along with the soil can be thought of as the Plant or system to becontrolled. Changes in the Plant input (sprinkler turn ON signal) will effectivelychange the Plant output (moisture level of soil). So the soil will be watered as andwhen necessary.
I hope that you can design an automatic sprinkler system for your home garden. Hereis an assignment for you:
Assignment 1: Design an automatic alarm system for ATM Machine.
2 A Generic Control System
Command signal
Controller Actuator PlantResponse
Feedback Sensor
+
-
.
Figure 2: A general control system
In Figure 2, a schematic block-diagram is given that depicts a generic control System
which consists of following components:
Plant
Controller
Actuator
Feedback Sensor
Within the scope of this course, we would mainly deal with mathematical representa-tion of Systems (Plants) and focus on Controller algorithms, not on the hardware imple-
mentation. We would assume the Actuator and Sensors to be available and having idealbehaviours.A control engineer designs a controller to control some of the physical variables of a plantor a system. The plant can be a DC motor, or a Power plant generation unit, or itcan be a robot manipulator. In general, a plant that is made up from various physicalcomponents follows some physical laws. The plant dynamics is expressed mathematicallywhich describes the plant behaviour in terms of input and response/output. For exampleconsider a mass M resting on a friction-less surface. A horizontal force u(t) is acting onthe mass M. The position of the mass x is given by the following equation:
M
d2x
dt2 =u(t) (1)
Thus the dynamics of a force-mass system as described above is governed by second orderdifferential equation. In general plant dynamics are expressed in terms of differentialequations. Further plant dynamics can be either linear or nonlinear.
2
8/13/2019 control system analysis-Lecture 1
3/21
Example: Separately excited DC Motor
Figure 3 shows the circuit diagram explaining the operation of this motor. The motorarmature receives a DC volt as input. The Armature rotates in the magnetic field set upby the stator field. The current carrying conductors in the armature are subjected to aninduced emf which is also called as back emfeb =Kb. The motor shaft is connected to aload parametrized byJ, the moment of inertia and B, the viscous coefficient. It turns outthat this motorgenerates a torque that is proportional to armature current ia. Looking
at the circuit, you should be able to write corresponding dynamic equations.
Figure 3: Separately excited DC motor
Tm=KTia (2)
eb=Kb (3)
Ladia
dt +Raia+eb =ea (4)
J
d
dt +B +T =Tm= KTia (5)Please note that this system has two state variables: ia and Let x1 =, x2 =ia
dx1
dt =
B
Jx1+
KT
J x2 (6)
dx2
dt =
Ra
Lax2
Kb
Lax1+
1
Laea (7)
The system is thus represented in the form of vector differential equation which can begeneralised as
x= Ax+Bu (8)
wherex= [x1 x2]
T (9)
3
8/13/2019 control system analysis-Lecture 1
4/21
8/13/2019 control system analysis-Lecture 1
5/21
0 10 20 30 40 50 60 700
0.05
0.1
0.15
0.2
0.25
Figure 4: Step response of the DC motor system
Figure 5 shows a RLC circuit. Input for this system is the voltage given as vS. We areinterested in the capacitor voltagevC- lets term it as output variable. You probably havefigured out that the current through inductor iL is another state variable. The dynamic
Figure 5: Electrical circuit
equations for this circuit can be written as:
Cdv
Cdt =i
C=iL vC
R (16)
LdiC
dt +vC=vS (17)
5
8/13/2019 control system analysis-Lecture 1
6/21
By selecting states as x1 =vC and x2=iL with initial conditions as iL(0) =i0L, vC(0) =
v0C, the state equations can be written as
dx1
dt =
1
RCx1+
1
Cx2 (18)
dx2
dt =
1
Lx1+
1
Lvs (19)
The step response of the system is shown in the Figure 6. The corresponding Matlabcode is given below:
% E l e c t r i c a l C ir c ui tc l c ;
C = 0 . 0 3 ;R = 1 0 ;L = 0 . 0 0 4 5 ;
A = [ (1/(CR) ) ( 1/C ) ; (1/L ) 0 ] ;B = [ 0 ; (1 /L ) ] ;C = [ 1 0 ] ;D = 0 ;
s y s = s s ( A, B , C ,D ) ;
% I n i t i a l C on di ti on si L 0 = 0 . 0 2 ;v C 0 = 2 . 1 ;
x0 = [ i L 0 v C 0 ] ;T = 0 : 0 . 0 1 : 1 0 ;U = o n es ( s i z e (T ) ) ;[ y , t , x ] = l s i m ( sy s , U, T, x 0 ) ;p l o t ( t , y )
Example: Single Link Manipulator
Figure 7 shows a single link manipulator that rotates in the vertical plane under the
influence of gravity.Input is motor torque that rotates the link and the response is angular position. It
is assumed that the link is mass-less and there is a point mass at the top. The dynamicsof motion of this rigid link is given as
ml2d2
dt2 +mgl sin = (20)
Taking system states as x1 =, x2= , the state models are derived as
x1 = x2 (21)
x2=g
l sin x1+
1
ml2 (22)
The step response of the system is shown in the Figure 2. The corresponding Matlab codeis given below:
6
8/13/2019 control system analysis-Lecture 1
7/21
0 2 4 6 8 100.5
0
0.5
1
1.5
2
2.5
Figure 6: Step response of the circuit
Figure 7: Single link manipulator
% S i n g l e L in k M a ni pu la t or[ T, Y] = o de 1 5s ( @vdp1000 , [ 0 1 0 ] , [ 0 0 ] ) ;
f u n c t i o n dy = v dp 10 00 ( t , y )g = 1 ;m = 1 ;l = 1 ;dy = z er o s ( 2 , 1 ) ; % a c olumn v ec to rdy ( 1 ) = y ( 2 ) ;d y ( 2 ) = g/ l s i n ( y ( 1 ) ) + s i n ( 3 t ) /(m l l ) ;
From these three examples, you can notice that first two systems are linear while thethird one is nonlinear. How will you ascertain a system is linear?
3 Linear System
A linear system follows two primary properties:
1. It obeys the principle of superposition.
2. The response of a linear time-invariant (LTI) system can be expressed as the con-volution of the input signal with unit impulse response.
7
8/13/2019 control system analysis-Lecture 1
8/21
0 1 2 3 4 5 6 7 8 9 101
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
input
output
Figure 8: Step response of the single link manipulator system
u1 Plant y1 u2 Plant y2
1u1+2u2 Plant 1y1+2y2
Figure 9: Superposition Principle
3.1 Principle of Superposition
This is explained in Figure 9. Suppose that the plant produces a response y1 for an inputu1and response y2for input u2. It is said to follow the superposition principle if the plantproduces a response 1y1+2y2 for an input 1u1+2u2.
Example
Consider a system which obeys following dynamics:
y+ky = u
Show that this system follows superposition principle.
Solution:
Lety1and y2are solutions for inputsu1and u2respectively. This implies that y1+ky1 = u1and y2+ ky2 = u2 are valid identity. Let y = 1y1+ 2y2. Then its derivative can be
reduced as follows:y = 1y1+2y2
= 1(u1 ky1) +2(u2 ky2)
= k(1y1+2y2) + (1u1+2u2)
8
8/13/2019 control system analysis-Lecture 1
9/21
This shows that ifu1 triggers response y1 and u2 triggers response y2, then 1u1+ 2u2triggers response 1y1+2y2. Thus superposition principle holds.
Q. What is the benefit of superposition?A. Response to a general signal is the sum of responses to elementary signals where thegeneral signal is expressed as sum of elementary signals. In general, impulse andexponential signals are considered as elementary signals.
3.2 Response of a Linear System
Definition of an impulse: A very intense force for a very short duration. Paul Diracprovided mathematical definition of an impulse (t) as
f()(t )d=f(t)
where
(t )d= 1
Superposition Integral:Let h(t, ) be the impulse response of a linear system at t to an impulse applied at
y(t) =
u()h(t, )d
if the system is LTI, then
y(t) =
u()h(t )d
=
u(t )h()d
This implies that the response of a LTI system to an exponential is also an exponential.
Example
Find the response of the following dynamic system
y+ky =u, y(0) = 0
Solution:
First find the impulse response.y+ky = (t) 0+
0ydt +k
0+0
ydt =
0+0
(t)dt
This gives,y(o+) y(0) = 1
Thus the system becomesy+ky = 0withy(0+) = 1
Let the solution to this differential equation be y = Aest
. Then substituting it in theabove equation, we get
Asest +kAest = 0
(s +k)Aest = 0
9
8/13/2019 control system analysis-Lecture 1
10/21
This implies s+k = 0 or s = k. At t = 0, y(0+) = 1. This implies that y(0+) = 1 =Aek.0 => A= 1. Thus impulse resonse becomes h(t) =ekt.
The final response due to any input u(t) is given by the convolution integral:
y(t) =
0
u()ek(t)d (23)
.In control system, the dynamic analysis of a linear plant is done using two approaches,
1. Transfer function approach
2. State space approach
4 Transfer Function
Before we introduce the concept of transfer function, the concept of Laplace Transformis revisited here.
4.1 Laplace Transform
The Laplace Transform is one of the mathematical tools used to solve linear ordinarydifferential equations.
Given the real function f(t) that satisfies the condition0
|f(t)et|dt <
for some finite, real , the Laplace Transform off(t) is defined as
F(s) =0
f(t)estdt
where s is referred to as a laplace operator which is a complex variable, i.e, s= +j.Please refer any reference book to go through important theorems on Laplace Trans-
forms. However, we will present two important theorems here.
Theorem 1 (Final-Value Theorem) If the Laplace Transform of f(t) is F(s) and ifsF(s) is analytic on the imaginary axis and in the right half of the s-plane then
limt
f(t) = lims
0sF(s)
Theorem 2 (Real Convolution) Let F1(s) and F2(s) be the Laplace Transforms off1(t) andf2(t) respectively andf1(t) = 0, f2(t) = 0 for t
8/13/2019 control system analysis-Lecture 1
11/21
Consider the differential equation
d2y(t)
dt2 + 3
dy(t)
dt + 2y(t) = 5u(t)
where u(t) is a unit step function. The initial conditions are y(0) = 1 and dydt
= 0 att= 0. Find the solution using Laplace Transform. Apply final value theorem to determinethe steady-state solution.
Solution: Applying Laplace Transform to both sides
s2Y(s) sy(0) dy
dt(0) + 3sY(s) 3y(0) + 2Y(s) =
5
s
Substituting initial values,
Y(s) = s2 3s + 5
s(s + 1)(s + 2)=
5
2s
7
s + 1+
7
2(s + 2)
Taking the inverse Laplace Transform, we get the complete solution as
y(t) =52 7et +7
2e2t
Now applying final value theorem,
limt
y(t) = lims0
sY(s) = lims0
ss2 3s + 5
s(s + 1)(s + 2)=
5
2
This result can be obtained from the solution of y(t) by putting t= .
4.2 Transfer function of a single-input single-output (SISO) sys-
tem
Lets take a simple plant,y+ 2y= u
where initial conditions are zero. The impulse response is found to be
h(t) =e2t
The actual response is given by the convolution
y(t) = h(t)u(t )d=
0
h(t)u(t )d
Using theorem 2, we get
Y(s) = H(s)U(s)
Y(s)
U(s) = H(s)
where H(s) is the transfer function. In this case,
H(s) = L(e2t
) =
1
s + 2
Formally, the transfer function of a linear time-invariant system is defined as the
Laplace transform of the impulse response, with all the initial conditions set to zero.
11
8/13/2019 control system analysis-Lecture 1
12/21
4.2.1 Incorrect use of final value theorem
Given,
Y(s) = 3
s(s 2)
Then, Note that
y() = lims0
sY(s) =3
2
Rather,y() = lim
ty(t) = lim
t[
3
2+
3
2e2t] =
DC gain
It is the ratio of the output of a system to its input at steady state i.e., all the transientshave decayed.
DC gain = lims0
G(s)
Example 1. Consider a transfer function
G(s) = 3
s2 + 2s 3
It has two poles namely, s= 1 and s= 3. Since one of them is unstable, we cannot find the dc gain. The final value theorem is not applicable in this case.
Example 2. Consider another transfer function
G(s) = s + 1
s2 +s+ 3
It has two stable poles (s= 12 i
112 ). By applying final value theorem, we get
dc gain =1
3= 0.333
Laplace transform has been introduced for representing linear dynamical systems be-cause of following two important reasons:
1. The diferential equations are converted to algebraic equations. More of this aspectwill be covered in control system representation through block diagram and signalflow graph.
2. The convolution integral in time domain gets represented as simple multiplicationin s-plane.
4.2.2 Exercise
1. Find the transfer function Y(s)U(s)
for the following systems:
(a) d3y(t)dt3
+ 4 d2y(t)dt2
+ 5 dy(t)dt
+ 2y(t) = 6du(t)dt
+u(t)
(b) 3d2y(t)dt2 dy(t)
dt + 3y(t) = 2u(t) u(t 1)
(c) d4
y(t)dt4 + 10 d
2
y(t)dt2 + dy(t)dt + 5y(t) = 5u(t)
(d) d3y(t)dt3
+ 10 d2y(t)dt2
+ 2 dy(t)dt
+y(t) + 2t0
y ()d= du(t)dt
+ 2u(t)
2. Find the response of the following systems to a unity step input:
12
8/13/2019 control system analysis-Lecture 1
13/21
(a) G(s) = 10(s+1)s(s+4)(s+6)
(b) G(s) = 1s(s2+1)(s+0.5)
(c) G(s) = (s+1)s(s+3)(s2+4s+8)
Verify your solutions using MATLAB commands.
3. Solve the following ordinary differential equation using Laplace transforms
(a) y(t) 2y(t) + 4y(t) = 0; y(0) = 1, y(0) = 2
(b) y(t) + 3y(t) =sin(t); y(0) = 1, y(0) = 2
(c) y(t) +y(t) =t; y(0) = 1, y(0) = 1
Verify your results using MATLAB.
4. Find the time function corresponding to each of the following Laplace transformsusing partial fraction expansions:
(a) F(s) = 2s(s+2)
(b) F(s) = 3s+2s2+4s+20
(c) F(s) = 1s2+4
(d) F(s) = s+1s2
5 State Variable Model
Example
Consider a nth order differential equationdny
dtn +a1
dn1y
dtn1 +. . . +any = u
Define following variables,
y = x1dy
dt = x2
... = ...
dn1y
dtn1 = xn
dny
dtn = a1xn1 a2xn2 . . . anx1+u
The nth order differential equation may be written in the form ofn first order differentialequations as
x1 = x2
x2 = x3... =
...
xn = a1xn1 a2xn2 . . . anx1+u
or in matrix form as,x= Ax +Bu
13
8/13/2019 control system analysis-Lecture 1
14/21
where
A=
0 1 0 . . . 00 0 1 . . . 0... . . .
...0 0 0 . . . 1
B=
00...1
The output can be one of states or a combination of many states. Since, y= x1,
y= [1 0 0 0 . . . 0]x
Transfer function approach of system modeling provides final relation between outputvariable and input variable. However, a system may have many other internal variablesof concerns to a control engineer. State variable representation takes into account of allsuch internal variables.
State: The state of a dynamic system is the smallest set of variables, x Rn, such
that given x(t0) and u(t), t > t0, x(t), t > t0 can be uniquely determined.
Usually a system governed by a nth order differential equation or nth order transferfunction is expressed in terms ofn state variables: x1, x2, . . . , xn.
A generic structure of a state-space model of a nth order dynamical system is givenby:
x1 = a11x1(t) +a12x2(t) +. . . +a1nxn(t) +b1u(t)x2 = a21x1(t) +a22x2(t) +. . . +a2nxn(t) +b2u(t)... =
...xn = an1x1(t) +an2x2(t) +. . . +annxn(t) +bnu(t)
y = c1x1(t) +c2x2(t) +. . . +cnxn(t) +du(t)
Thus the generalized state variable representation in compact form looks as:
x= Ax +Bu
y= Cx +du (24)
where
A=
a11 a12 a13 . . . a1n
a21 a22 a23 . . . a2n... . . .
...an1 an2 an3 . . . ann
B=
b1
b2...bn
C= c1 c2 c3 . . . cn
6 System Response
Given a system in state-space form, how can we compute the state response and outputresponse of such systems? From the scope of this course, you will find that LaplaceTransform will play a BIG role. Lets take an example of a simple scalar differentialequation:
x(t) =ax, x(t0) =x0
You already know the generic solution:
x(t) =keat where k= x0eat0
14
8/13/2019 control system analysis-Lecture 1
15/21
What happens to Vector differential equation?
x= Ax, x(t0) =x0
Intuitively, the generic solution can be taken as: x(t) =eAtk. But what is this entityeAt?
eAt =I+ At+ 1
2!A2t2 +
1
3!A3t3 +...
d
dt(eAt) = A+A2t+
1
2!A3t2 +...
= A(I+ At+ 1
2!A2t2 +...)
= AeAt
So, taking the solution as x(t) =eAtk,
x(t) =kd
dt(eAt) =AkeAt =Ax
This solution thus satisfies the vector differential equation.
k= eAt0x0
x(t) =eA(tt0)x0
Ift0= 0 ,x(t) =eAtx0
How does one compute eAt ?
x= Ax, x(0) =x0
Taking Laplace Transform,sX(s) x0 =AX(s)
(sI A)X(s) =x0
X(s) = (sI A)1x0
x(t) = L1[(sI A)1x0] =eAtx0
So,eAt = L1[(sI A)1]
This expression eAt
is called as state transition matrix. We will learn more about thisstate transition matrix later in this course.
Example 1
Given
A=
0 12 3
Compute eAt
Solution
15
8/13/2019 control system analysis-Lecture 1
16/21
sI A =
s 00 s
0 12 3
=
s 12 s + 3
[sI A]1 = 1
s(s + 3) + 2
s + 3 12 s
= 1s2 + 3s + 2
s + 3 12 s
=
1
(s + 2)(s + 1)
s + 3 12 s
=
2s+1 1s+2 1s+1 1s+2 2
s+1+ 2
s+22
s+2 1
s+1
eAt = L1[sI A]1
= L1
2s+1 1s+2 1s+1 1s+2 2
s+1+ 2
s+22
s+2 1
s+1
=
2et e2t et e2t
2et + 2e2t et + 2e2t
We will now investigate the solution of the state model with external input:
x= Ax +Bu
Taking Laplace transform,
sX(s) x0=AX(s) +BU(s)
(sI A)X(s) =x0+BU(s)
X(s) = (sI A)1x0+ (sI A)1BU(s)
x(t) =eAtx0+
t0
eA(t)BU()d
y(t) =C x(t) =C eAtx0+ t
0
CeA(t)BU()d
6.1 Solution of State Equation - Another Approach
Consider the state equation
x(t) =Ax(t) +Bu(t); x(t0) =x0 (6)
We will find the solution of this state equation using following identity
d
dteAt =AeAt =eAtA (Exercise: Verify this)
Multiplying both sides of Eqn. (6.1) with eAt
, we geteAtx(t) = eAtAx(t) +eAtBu(t)
eAtx(t) eAtAx(t) = eAtBu(t)
16
8/13/2019 control system analysis-Lecture 1
17/21
Since,d
dt
eAtx(t)
= eAtx(t) eAtAx(t)
we have,d
dt
eAtx(t)
= eAtBu(t)
Integrating both sides,
t0
d(eAx()) = t0
eABu()d
eAtx(t) x(0) =
t0
eABu()d
Thus, the solution of state equation is given as
x(t) =eAtx(0) +
t0
eA(t)Bu()d
Alternately, we can derive this solution by using Laplace transform as follows. We knowthat X(s) = (sIA)1x0 + (sIA)
1BU(s). Taking inverse Laplace transform on bothsides, we get
x(t) =L1[(sI A)1x0] + L1[(sI A)1BU(s)]
Since, it can be verified that x(t) = eAtx0 is a solution of x(t) = Ax(t), x(t0) = x0, bycomparison, we can write
L1(sI A)1 =eAt
Since L1[(sI A)1BU(s)] is a convolution integral, the complete solution becomes
x(t) =eAtx0+
t0
eA(t)Bu()d (1)
Example 2
Find the solution of the system described by
x = Ax +Bu
y(t) = Cx
where
A=
1 11 10
, B=
010
, C=
0 10
and thus the response of the system to a unit step input under zero initial condtions.
Solution:
(sI A)1 =
s + 1 1
1 s + 10
1
= 1
s2 + 11s + 11
s + 10 11 s + 1
=
s+10
(s+a1)(s+a2)1
(s+a1)(s+a2)1
(s+a1)(s+a2)s+1
(s+a1)(s+a2)
where a1 = 1.1125 and a2 = 9.8875.
eAt = L1[(sI A)1]
=
1.0128ea1t 0.0128ea2t 0.114ea1t 0.114ea2t
0.114ea1t + 0.114ea2t 0.0128ea1t + 1.0128ea2t
17
8/13/2019 control system analysis-Lecture 1
18/21
The input is u(t) = 1; t 0 and x(0) =0. Therefore,
x(t) =
t0
eA(t)bd
=
t0
1.14
ea1(t) ea2(t)
1.14
0.1123ea1(t) + 8.8842ea2(t)
= 0.9094 1.0247ea1t + 0.1153ea2t0.0132 + 0.1151ea1t 0.1019ea2t
The output
y(t) = 0.9094 1.0247e1.1125t + 0.1153e9.8875t
6.2 Conversion of state variable models to transfer function
Consider a state variable model
x(t) = Ax(t) +Bu(t)
y(t) = Cx(t) +du(t) (-9)
Taking the Laplace Transform on the both sides of Eqn. (-8), we get
sX(s) x0 = AX(s) +BU(s)
Y(s) = CX(s) +dU(s)
(sI A)X(s) = x0+BU(s)or, X(s) = (sI A)1x0+ (sI A)
1BU(s)
If we let x0 = 0, then
Y(s) = C(sI A)1B+dU(s)Therefore, the transfer function becomes
Y(s)
U(s)=C(sI A)1B+d (-12)
6.2.1 Exercise
1. Construct state models for the following differential equations.
(a) ...
y + 3y+ 2y= u +u
(b) ...
y + 6y+ 11y+ 6y= u
(c) ...y + 6y+ 11y+ 6y=...u + 8u + 17u + 8u
2. Consider the system
x=
0 12 3
x +
01
u; x(0) =
11
y =
1 0x
Find the output response of the system to unit-step function.
3. Consider the following system
x=
2 1
1 2
x +
11
u; x(0) =
11
Find the solution of the state equation.
18
8/13/2019 control system analysis-Lecture 1
19/21
4. An oscillation can be generated by
x=
0 11 0
x
Show that its solution is
x=
cos t sin t
sin t cos t
x
5. Use two different methods to find the unit-step response of
x=
0 12 2
x +
11
u
y= [2 3]x
7 Numerical Integration
The state model of an autonomous non-linear system is given as follows
x= f(x(t), u(t)), x(t0) = x0 (-12)
It is desired to find solution of this differential equation in the interval [t0,t1] using variousnumerical integration techniques.
Eulers Method
Divide the interval [t0, t1] into N equal sub-intervals of width h= tft0
N . his called
step length.
Settk =t0+kh,k = 1, 2, . . . , N . The derivative dx(tk)
dt at timet = tkis approximated
as dx(tk)dt
x(tk+1) x(tk)
h (-12)
From Eqn. (7) and Eqn. (7), we get
x(tk+1) x(tk)
h =f(x(tk), u(tk))
This gives the update equation
x(tk+1) = x(tk) +hf(x(tk), u(tk)) (-12)
Runge-Kutta 4th Order Algorithm
The update equation is given as follows:
x(tk+1) =x(tk) +h
6(m0+ 2m1+ 2m2+ m3) (-12)
where
m0 = f(tk,x(tk), u(tk))
m1 = f(tk+h
2 ,x(tk) +
m0h
2 , u(tk))
m2 = f(tk+h
2,x(tk) +
m1h
2 , u(tk))
m3 = f(tk+h,x(tk) + m2h, u(tk))
19
8/13/2019 control system analysis-Lecture 1
20/21
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Impulse Response
Time (sec)
Amplitude
Euler integration with h=0.1
Matlab plot using command impulse
Figure 10: Numerical Solution of state equation using Eulers method
Example
Find impulse response of the following system in the interval [0,1] using Eulers method
x+ 4x= (t), x(t0) = 0
Solution:
Take h= 0.1. Using the update equation (7), we have
x(tk+1) =x(tk) +h(4x(tk) +(tk))
Thus, for t= 0.1,x(0.1) = 0 + 0.1(4x(0) +(0)) = 1.0x(0.2) = 1 + 0.1(4x(0.1)) = 1 0.4 = 0.6
Similarly, we can calculate other values as shown in the table 7. The result is showngraphically in the Figure 10 where it is compared with the simulation obtained using aMATLAB function that uses a very small step size.
tk 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x(tk) 0 1.0 0.6 0.36 0.216 0.1296 0.0776 0.0467 0.0280 0.0168 0.01
Table 1: Values ofx(t) obtained from Eulers integration
8 MATLAB Assignment
Consider the following nonlinear system:
x= x+x2
Find the solution of the above state equation using Euler, Runge-Kutta methods andMatlab command (ode45) for following intial conditions x0 = 0.5, -0.5 and 1.5. For Eulerand Runge-Kutta method, write your own code and verify your result using ode45 routinein MATLAB.
20
8/13/2019 control system analysis-Lecture 1
21/21