Upload
others
View
10
Download
1
Embed Size (px)
Citation preview
Introduction Mathematical modeling Examples Difference equation iteration
IntroductionMathematical modelingModeling Systems and Processes
Bohumil Kovar
Department of Applied MahematicsCTU in Prague, Faculty of Transportation Sciences
1. lecture 11MSP2019
verze: 2019-02-25 16:18
Introduction Mathematical modeling Examples Difference equation iteration
Table of Contents
1 Introduction
Basic information
Literature
Exam
Prerequisites
Output knowledge
2 Mathematical modeling
3 Examples
4 Difference equation iteration
Introduction Mathematical modeling Examples Difference equation iteration
Basic information
Lecturer:
• Ing. Bohumil Kovar, Ph.D. ([email protected])Tu. 9:45 - 12:00 (reserve Th. 11:30 - 13:00)
Homepage:
http://zolotarev.fd.cvut.cz/msp
Introduction Mathematical modeling Examples Difference equation iteration
Literature I
1 CARLSON, Gordon E. Signal and Linear System Analysis:with Matlab. 2. vyd. New York: John Wiley & Sons, 1998,768 s. ISBN 04-711-2465-6.
2 CHATURVEDI, Devendra K. Modeling and simulation ofsystems using MATLAB and Simulink. Boca Raton: CRCPress, 2009, 733 s. ISBN 978-143-9806-722.
3 OPPENHEIM, Alan V., Alan S. WILLSKY a Syed HamidNAWAB. Signals and Systems. 2. vyd. Upper Saddle River:Prentice Hall, 1997, 957 s. ISBN 01-381-4757-4.
Introduction Mathematical modeling Examples Difference equation iteration
Credits and final exam
The total number of points students can get from the tests duringthe semester is 40.
We require at least 25 points
Tests:
• 10 pt (2+4+4) – 3 tests,
• 4 pt – homeworks,
• 12 (6+6) – practical tests from Matlab and Simulink,
• 14pt – final credit test
Introduction Mathematical modeling Examples Difference equation iteration
Credits and final exam
Scoring ensures that if you get a credit (25 points and above), youcan automatically complete the course with the classification E orD.
In case you are looking for a better classification (A – C), you canacquire the remaining 20 points in the final exam.
Introduction Mathematical modeling Examples Difference equation iteration
Prerequisites
This is the knowledge that we assume you have.
1 basic operations with vectors and matrices
2 complex numbers
3 elementar functions
4 infinite series, derivatives and integrals of the function of onevariable
5 elementary math - fractions, algebraic calculations, equations,...
6 basic knowledge of Scilab/Matlab
Introduction Mathematical modeling Examples Difference equation iteration
Output knowledge
1 Laplace transformation for solving differential equationsdescribing continuous linear invariant systems
2 Z-transformation for solving differential equations describingdiscrete linear time-invariant systems
3 state-space description of the dynamic system
4 concept of stability of the dynamic system and the solutionverification methods
5 knowledge of MATLAB / SIMULINK environment formodeling of dynamic systems
Introduction Mathematical modeling Examples Difference equation iteration
Table of Contents
1 Introduction
2 Mathematical modeling
Model of the system
External description
Internal description
3 Examples
4 Difference equation iteration
Introduction Mathematical modeling Examples Difference equation iteration
Definition Study Testing Usage
This iterative process is typical for modeling projects and is one ofthe most useful aspects of modeling in terms of betterunderstanding how the system works.
Introduction Mathematical modeling Examples Difference equation iteration
System
Definition (System)
Characteristic features that are needed for modeling:
• the system is considered to be part of an environment thatcan be separated from its surroundings by physical or mentalboundaries,
• the system consists of subsystems, interconnected componentsthat communicate with each other.
It’s part of our world that somehow interacts with oursurroundings, for example through input and output.
Introduction Mathematical modeling Examples Difference equation iteration
What is modeling?
Model
The model can by considered as a replacment or simplification ofthe real world object in terms of its properties and functionality.
Modeling is only possible if we use some degree of abstractionand approximation.
Introduction Mathematical modeling Examples Difference equation iteration
Discrete and continuous model
input output?u(t) continuous system y(t)
u[n] discrete system y[n]
Introduction Mathematical modeling Examples Difference equation iteration
Why modeling systems?
Questions:
• How do we verify the accuracy of epidemic spread calculation?
• How do we verify the strength of the new bridge?
• How to verify the impact of the macroeconomic model beforeusing it?
If we can not pre-prove certain properties of our system, we areable to show the desired properties on its model!
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsAntoni Gaudı
Spanish Catalan architect Antoni Gaudı disliked drawings andprefered to explore some of his designs — such as the SagradaFamılia — using scale models made of chains or weighted strings.
Gaudı’s upside-down physical models took him years to build butgave him more flexibility to explore organic designs, since everyadjustment would immediately trigger the ”physicalrecomputation” of optimal arches.
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsAntoni Gaudı
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsAntoni Gaudı
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsAntoni Gaudı
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsAntoni Gaudı
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsVW Polo crash test
The origins of industrial first principle computerized car crashsimulation lie in military defense and nuclear power plantapplications.
The sofware used for simulation of accidental crash of a militaryfighter plane into a nuclear power plant (1978) evolved totechnology for the simulation of destructive car crash tests (1986)
These simulation codes recreated a frontal impact of a fullpassenger car structure and they ran to completion on a computerovernight.
Engineers were able to make efficient and progressive improvementsof the crash behavior of the analyzed car body structure.
Introduction Mathematical modeling Examples Difference equation iteration
Examples of real world modelsVW Polo crash test
Introduction Mathematical modeling Examples Difference equation iteration
External description
The external description is based on the description of the systeminput u and the output y.
We understand the system as a black box, whose properties weobserve only if we examine its reaction to external events (signals,data).
The external model is described by the one differential equation forcontinuous time systems and the one difference equation fordiscrete time systems. The equations order are generally higherthan 1.
Introduction Mathematical modeling Examples Difference equation iteration
Internal description
The internal, so-called state-space, description uses the vector ofinternal states x to describe the dynamics of the system.
The input vector u and the output vector y are secondary variablesof the internal description. We describe state-based models by:
• a system of first order differential equations for continuoustime systems and a
• a system of first order difference equations for discrete timesystems.
Introduction Mathematical modeling Examples Difference equation iteration
The role of mathematics
Modeling is not self-sustaining:
• the outputs of the model must always be verified,
• possible errors are both in the model and in its calculation.
Verification: We calculate the correct model.
Validation: The model calculates correctly.
Introduction Mathematical modeling Examples Difference equation iteration
Table of Contents
1 Introduction
2 Mathematical modeling
3 Examples
4 Difference equation iteration
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model (1/7)
SIR model equations
S ′(t) = −αI (t)S(t)
R ′(t) = βI (t)
I ′(t) = −S ′(t)− R ′(t) = αI (t)S(t)− βI (t)
S(t) for the number susceptibleI (t) for the number of infectiousR(t) for the number recovered (or immune)
S(t) + I (t) + R(t) = c
S ′(t) + I ′(t) + R ′(t) = 0
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - numerical solution (2/7)
What do these equations tell us? Suppose the S(0) = 100000healthy population, I (0) = 10 infected and R(0) = 10 immunewith infection rate α = 0.0001 and mortality β = 0.1. At timet = 0, today:
S ′(0) = −αI (0)S(0) = −100
R ′(0) = βI (0) = 1
I ′(0) = −S ′(0)− R ′(0) = αI (0)S(0)− βI (0) = 99
On the first day of the flu epidemic, the number of healthyindividuals will be reduced by 100, one person will die and thenumber of infected people will increase by 99.
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - numerical solution (3/7)
So tomorrow, at t = 1 we can expect
S(1) ≈ S(0) + S ′(0) = 99900
R(1) ≈ R(0) + R ′(0) = 11
I (1) ≈ I (0) + I ′(0) = 109
a
S ′(1) = −αI (1)S(1) = −1088.91
R ′(1) = βI (1) = 10.9
I ′(1) = −S ′(1)− R ′(1) = αI (1)S(1)− βI (1) = 1078.01
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - numerical solution (4/7)
Equations allow us to estimate changes in S , I ,R i in the past. Ifwe know the state of the epidemic today (in time t = 0), then wecan estimate the values yesterday (in time t = −1) as
S(−1) ≈ S(0)− S ′(0)
R(−1) ≈ R(0)− R ′(0)
I (−1) ≈ I (0)− I ′(0)
Thus, we can numerically analyze the changes of S , I and R intime, and predict how the epidemic will evolve. These arecalculations are recurrent and very easy to calculate usingcomputer.
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - Simulink (5/7)
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - Simulink (6/7)
0 5 10 15 20 25 30 35 40 45 500
1
2
3
4
5
6
7
8
9
10 x 104
Time offset: 0 α = 0.00015, β = 0.11, S(0) = 100000, I (0) = R(0) = 10
Introduction Mathematical modeling Examples Difference equation iteration
Flu epidemicSIR model - Analytical solution (7/7)
Analysis of Equation for Infected people
I ′(t) = αS(t)I (t)− βI (t) = (αS(t)− β)I (t)
When
• S(t) > βα then I ′(t) > 0 and so the epidemic worsens and the
number of infected grows,
• S(t) < βα then I ′(t) < 0 the situation is getting better and
the number of infected decreases,
• ⇒ βα is a threshold.
The number of infected will therefore decrease if we can reduce thevalue of the α (and) or β coefficient.
Introduction Mathematical modeling Examples Difference equation iteration
Supply and DemandExample of price variation (1/2)
Offer (supply) Equation
The offer of today depends on the price of the yesterday, so thatthe offer rises with a rising price. For C > 0 supply is
s[k] = Cp[k − 1] +Au[k].
Demand Equation
The demand for today depends on the today price,so demand isfalling with a rising cost. For D > 0 demand is
d [k] = −Dp[k] + Bu[k].
Introduction Mathematical modeling Examples Difference equation iteration
Supply and DemandExample of price variation (1/2)
Equilibrium of supply and demand
s[k] = d [k]
then leads to the first-order difference equation
p[k] +CDp[k − 1] =
B −AD
u[k].
Introduction Mathematical modeling Examples Difference equation iteration
Supply and DemandExample of price variation - result
0 1 2 3 4 5 695
100
105
110
115
120
125
cena
nabí
dka
a po
ptáv
ka
Introduction Mathematical modeling Examples Difference equation iteration
Table of Contents
1 Introduction
2 Mathematical modeling
3 Examples
4 Difference equation iteration
The price equation iteration
Introduction Mathematical modeling Examples Difference equation iteration
Price equation iteration
Difference equation,
c[k] +CDc[k − 1] =
B −AD
u[k]
we can write in the canonical form1, where the outputs are locatedon the left side and the inputs on the right side of the equation,sorted by the time shift:
y [k] + αy [k − 1] = βu[k]
Now for k = 0, . . . , n, u[k] = 1[k] and initial condition y [−1] = 0we get
1writing in canonical form allows easier orientation.
Introduction Mathematical modeling Examples Difference equation iteration
Price equation iteration
For k = 0:
y [0] + γy [−1] = βu[0]
y [0] = β − γy [−1] = β
For k = 1:
y [1] + γy [0] = βu[1]
y [1] = β − γy [0] = β − βγ
Introduction Mathematical modeling Examples Difference equation iteration
Price equation iteration
For k = 2:
y [2] + γy [1] = βu[2]
y [2] = β − γy [1] = β − βγ + βγ2
. . . and generally for n:
y [n] + γy [n − 1] = βu[n]
y [n] = β − γy [n − 1] = β(1− γ + γ2 + · · ·+ (−γ)n
)
Introduction Mathematical modeling Examples Difference equation iteration
Price equation iteration
y [n] = β
n∑m=0
(−γ)m = β1− (−γ)n+1
1 + γ=
β
1 + γ+
βγ
1 + γ(−γ)n
0 1 2 3 4 5 695
100
105
110
115
120
125
cena
nabí
dka
a po
ptáv
ka