analysis of ode models with matlabszh/teaching/matlabmodeling/lecture7... · analysis of ode models...

29
Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB

Upload: vuthuan

Post on 29-Jun-2018

248 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Analysis of ODE models with MATLAB

Shan He

School for Computational ScienceUniversity of Birmingham

Module 06-23836: Computational Modelling with MATLAB

Page 2: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Outline

Outline of Topics

Some Concepts

Eigenvalue stability method

Phase Plane Analysis

Classification of ODE using phase-plane

Page 3: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Outline

What will we learn from this lecture

I Aim of analysis.

I Some concpets

I Eigenvalue Stability.

I Phase Plane Analysis.

Page 4: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Outline

Aim of analysis:

Given a large and complex system of ODEs describing thedynamics of a complex biological system, we need to answer:

I Where will it go?I Stable and damped?I Or unstable and undamped, e.g., constant fluctuation?I Or unstable with increasing fluctuation?

I What will it do?I Exponential decay?I Exponential increase?I Stable oscillation?I Chaotic solution?

Page 5: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Outline

Why such analysis matters?

I The MATLAB ODE solver only give solutions for one initialconditions.

I But we usually want to know how, given a set of initialconditions, the system will evolve with time?

I Provides insights into how biological systems behavior changeswhen stimuli and rate constants are modified.

I Biomedical applications: could provide information formechanism-based drug discovery.

Page 6: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Equilibrium of a dynamic system

I Definitions: Equilibrium, or fixed point, is a state of asystem which does not change.

I In ODE, we can calculate equilibria by setting all derivativesto zero because nothing is changing with respect to time.

Page 7: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Example: Equilibria of the Lotka-Volterra equation

I The Lotka-Volterra equation{dxdt = x(α− βy)dydt = −y(γ − δx)

I Set all derivatives to zero:{x(α− βy) = 0

−y(γ − δx) = 0

I When solved for x and y the above system of equations yieldstwo equilibria: {x = 0, y = 0} and {x = γ

δ , y = αβ }

Page 8: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Stable and unstable equilibrium

I Stable equilibrium: a system return to its equilibrium andremain there after disturbances.

I Unstable equilibrium: a system moves away from theequilibrium after disturbances

I Stability analysis is important:I Everything should be stable to be observableI Crucial for understanding complex systems

I The eigenvalues of a system linearized around a equilibriumcan determine the stability behavior of a system around thefixed point.

Page 9: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Eigenvector and Eigenvalue

Definitions:

I Eigenvector: A vector that maintains its direction afterundergoing a linear transformation. Also called characteristicvectors.

I Eigenvalue: The scalar value that the eigenvector wasmultiplied by during the linear transformation. Also calledcharacteristic values.

Page 10: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Eigenvalue and Eigenvector with Mona Lisa

I In the left picture, two vectors were drawn on the Mona Lisa.

I The picture is then linear transformed (sheared) and shown onthe right.

I The red arrow changes direction but the blue arrow does not.

I The blue arrow is an eigenvector, with eigenvalue 1 (lengthunchanged).

Page 11: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Fundamental Equation

Av = λv

where A is a square matrix, v is the Eigenvector and λ is theEigenvalue.

Page 12: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Some Concepts

Eigenvalue and Eigenvector in MATLAB

[V,D] = eig(A) produces matrices of eigenvalues D andeigenvectors V of matrix A

Page 13: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Eigenvalue stability method

Eigenvalue stability method

Steps:

I Step 1: Determining the equilibria

I Step 2: Determine the eigenvalue of the equilibria

I Step 3: Determine the stability based on the sign of theeigenvalue

Page 14: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Eigenvalue stability method

Example: eigenvalue stability methodLet’s consider a very simple linear system:{

dxdt = ydydt = 2x + y

I Step 1: Determining the equilibria{y = 0

2x + y = 0

. We have one equilibrium (0, 0)I Step 2: Determine the eigenvalue of the equilibrium

A =

(0 12 1

)Using D = eig(A) we have: λ1 = −1 and λ2 = 2.

Page 15: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Eigenvalue stability method

Example: eigenvalue stability method

Eigenvalue Type Stability OscillatoryBehavior

Notation

All Real and + Unstable None Nodal sourceAll Real and - Stable None Nodal sink

Mixed Real Unstable None Saddle point+a + bi Unstable Undamped Spiral source-a + bi Stable Damped Spiral sink0 + bi Unstable Undamped Centre

I Step 3: Determine the stability based on the sign of theeigenvalue.λ1 = −1 and λ2 = 2: Unstable saddle point

Page 16: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Eigenvalue stability method

Pros/Cons of eigenvalue stability

Advantages:

I Very accurate for linear systems.

I Can be applied to a variety of processes.

I Can be used for systems with undefined parameters.

Disadvantages:

I Only applicable for linear models.

Page 17: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

Phase Plane Analysis

I Eigenvalue stability method is only applicable for linearmodels. How about non-linear system?

I Usually there is no analytical solution for a nonlinear systemmodel.

I If the systems are second order (two-dimensional) systems, wecan use Phase Plane Analysis.

I Phase Plane Analysis is a very useful technique fordetermining the qualitative behaviour of solutions of lowdimensional nonlinear systems.

Page 18: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

Our first Phase Plane

x ’ = y y ’ = 2 x + y

−2 −1 0 1 2 3 4

−4

−3

−2

−1

0

1

2

x

yNullclines

Page 19: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

Phase Plane Explained:

I A phase-plane plot usually consists of curves of one dimension(state variable) versus the other dimension (x1(t) vs. x2(t)).

I Each curve is based on a different initial condition.

I The original PPlan plot has vector fields or slope fields ordirection fields.

I Each vector in vector field is a point (x,y) to a unit vectorwith slope x ′

1, x′2.

Page 20: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

Nullclines

Nullclines:

I For an ODE system, nullclines are the geometric shape for

whichdxj

dt = 0 for any j .

I Sometimes called zero-growth isoclines.

I They are boundaries for determining the direction of themotion along the trajectories.

I They split the phase plane into regions of similar flow.

I The intersection point of all the nullclines is an equilibriumpoint of the system.

Page 21: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

Phase Plane Analysis tool: PPlane

I A MATLAB tool useful for Phase Plane Analysis.

I Download from [here]

I Can run in MATLAB or as a JAVA Applet.

I Plot solution curves in the phase plane by simple clicking onthem.

I A number of advanced features, including finding equilibriumpoints, eigenvalues and nullclines.

Page 22: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Phase Plane Analysis

How to use Pplane

Page 23: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Classification of 2D ODE

I We have seen how to use eigenvalue to determine stable andunstable equilibrium.

I We can also use phase-plane to analyse ODE, but only for 1stand 2nd order ODE.

I We will use a few examples in MATLAB Pplane to illustratehow to do this.

Page 24: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Saddle

I Example:dy

dx=

(1 42 −1

)y

−2

−1

0

1

2−3

−2−1

01

23

−1

−0.5

0

0.5

1

yx

t

Page 25: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Nodal Source

I Example:dy

dx=

(3 11 3

)y

−10−5

05

10 −10−5

05

100

0.2

0.4

0.6

0.8

1

1.2

1.4

yx

t

Page 26: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Nodal Sink

I Example:dy

dx=

(−3 −1−1 −3

)y

−2

−1

0

1

2 −2

−1

0

1

20

0.5

1

1.5

2

yx

t

Page 27: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Centre

I Example:dy

dx=

(4 −102 −4

)y

−20

−10

0

10

20 −10−5

05

10

0

0.5

1

1.5

2

yx

t

Page 28: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Spiral Source

I Example:dy

dx=

(0.2 1−1 0.2

)y

−4−2

02

4 −4−2

02

4

0

0.5

1

1.5

2

yx

t

Page 29: Analysis of ODE models with MATLABszh/teaching/matlabmodeling/Lecture7... · Analysis of ODE models Analysis of ODE models with MATLAB Shan He School for Computational Science University

Analysis of ODE models

Classification of ODE using phase-plane

Spiral Sink

I Example:dy

dx=

(−0.2 1−1 −0.2

)y

−2

−1

01

2 −2

−1

0

1

20

2

4

6

8

10

yx

t