Modeling Biosystems Mathematical models are tools that biomedical engineers use to predict the...

Post on 17-Jan-2016

212 views 0 download

Transcript of Modeling Biosystems Mathematical models are tools that biomedical engineers use to predict the...

Modeling Biosystems

• Mathematical models are tools that biomedical engineers use to predict the behavior of the system.

• Three different states are modeled

• Steady-state behavior

• Behavior over a finite period of time

• Transient behavior

Modeling Biosystems

Modeling in BME needs an interdisciplinary approach.

• Electrical Engineering: circuits and systems; imaging and image processing; instrumentation and measurements; sensors.

• Mechanical Engineering: fluid and solid mechanics; heat transfer; robotics and automation; thermodynamics.

• Chemical Engineering: transport phenomena; polymers and materials; biotechnology; drug design; pharmaceutical manufacturing

• Medicine and biology: biological concepts of anatomy and physiology at the system, cellular, and molecular levels.

Modeling Biosystems

A framework for modeling in BME

• Step one: Identify the system to be analyzed.

• Step two: Determine the extensive property to be accounted for.

• Step three: Determine the time period to be analyzed.

• Step four: Formulate a mathematical expression of the conservation law.

Modeling Biosystems

Step one: Identify the system to be analyzed

• SYSTEM: Any region in space or quantity of matter set side for analysis

• ENVIRONMENT: Everything not inside the system

• BOUNDARY: An infinitesimally thin surface that separates the system from its environment.

Modeling Biosystems

Step two: Determine the extensive property to be accounted for.

• An extensive property doe not have a value at a point

• Its value depends on the size of the system (e.g., proportional to the mass of the system)

• The amount of extensive property can be determined by summing the amount of extensive property for each subsystem comprising the system.

• The value of an extensive property for a system is a function of time (e.g., mass and volume)

• Conserved property: the property that can neither be created nor destroyed (e.g. charge, linear momentum, angular momentum)

• Mass and energy are conserved under some restrictions

• The speed of the system << the speed of light

• The time interval > the time interval of quantum mechanics

• No nuclear reactions

Modeling Biosystems

Step three: Determine the time period to be analyzed.

• Process: A system undergoes a change in state

• The goal of engineering analysis: predict the behavior of a system, i.e., the path of states when the system undergoes a specified process

• Process classification based on the time intervals involved

• steady-state

• finite-time

• transient process

Modeling Biosystems

Step four: Formulate a mathematical expression of the conservation law.

• The accumulation form (steady state or finite-time processes)

• The rate form (transient processes)

Modeling Biosystems

The accumulation form of conservation

• The time period is finite

Net amountgenerated

Inside the system

Net amountAccumulated

Inside the system

Net amounttransported

Into the system = +

• )()( consumedgeneratedoutputinput PPPPinside

initialP

inside

finalP

• Mathematical expression: algebraic or integral equations

• It is not always possible to determine the amount of the property of interest entering or exiting the system.

Modeling Biosystems

The rate form of conservation

• The time period is infinitesimally small

Generation rateInto the system

at t

Rate of changeinside the system

at t

Transport rateinto the system

at t = +

• Mathematical expression: differential equations

• )()(

cgoi PPPPdt

dP

Modeling Biosystems

Example: How to derive Nernst equation?

Background: Nernst equation is used to describe resting potential of a membrane

The flow of K+ due to (1) diffusion (2) drift in an electrical field

Modeling Biosystems

Example: How to derive Nernst equation?

Diffusion: Fick’s law

dx

dIDJ diffusion

• J: flow due to diffusion

•D: diffusive constant (m2/S)

• I: the ion concentration

• : the concentration gradientdx

dI

Modeling Biosystems

Example: How to derive Nernst equation?

Drift: Ohm’s law

• J: flow due to drift

• : mobility (m2/SV)

• I: the ion concentration

• Z : ionic valence

• v: the voltage across the membrane

dx

dvZIJ drift

Modeling Biosystems

Example: How to derive Nernst equation?

Einstein relationship: the relationship between diffusivity and mobility

• K: Boltzmann’s constant (1.38x10-23J/K)

• T : the absolute temperature in degrees Kelvin

• q: the magnitude of the electric charge (1.60186x10-19C)

q

KTD

Modeling Biosystems

Example: How to derive Nernst equation?

0 driftdiffusion JJdt

dJ

K+

ioi K

K

q

KTvv

][

][ln 0

Concepts of Numerical Analysis

Errors: absolution and relative (given a quantity u and its approximation)

• The absolute error: |u - v|

• The relative error: |u – v|/|u|

• When u 1, no much difference between two errors

• When |u|>>1, the relative error is a better reflection of the difference between u and v.

Concepts of Numerical Analysis

Errors: where do they come from?

• Model errors: approximation of the real-world

• Measurement errors: the errors in the input data (Measurement system is never perfect!)

• Numerical approximation errors: approximate formula is used in place of the actual function

• Truncation errors: sampling a continuous process (interpolation, differentiation, and integration)

• Convergence errors: In iterative methods, finite steps are used in place of infinitely many iterations (optimization)

• Roundoff errors: Real numbers cannot be represented exactly in computer!

Concepts of Numerical Analysis

Taylor series: the key to connecting continuous and discrete versions of a formula

• The infinite Taylor series

• The finite Taylor formula

)(!

)()(''

2

)()(')()()( 0

)(00

20

000 xfk

xxxf

xxxfxxxfxf k

k

10

)(00

20

000 )(!

)()(''

2

)()(')()()(

kk

k

Rxfk

xxxf

xxxfxxxfxf

xxfk

xxR k

kk

0)1(

101 ),()!1(

)(

Concepts of Numerical Analysis

h=10.^(-20:0.5:0);dif_f=[sin(0.5+h)-sin(0.5)]./h; % numerical derivative for sin(0.5)delta=abs(dif_f-cos(0.5)); % absolute errors loglog(h,delta,'-*')

• h>10-8, truncation errors dominate roundoff errors

• h<10-8, roundoff errors dominate truncation errors

10-20

10-15

10-10

10-5

100

10-10

10-8

10-6

10-4

10-2

100

Concepts of Numerical Analysis

Floating point representation in computer

ettdddd

xfl 2)2842

1()( 321

• IEEE 754 standard, used in MATLAB

• di = 0 or 1

• 64 bits of storage (double precision)

• 1bit: sign s; 11 bits: exponent (e); 52 bits: fraction (t)s; 11 bits: exponent (e); 52 bits: fraction (t)

• A bias 1023 is added to e to represent both negative and A bias 1023 is added to e to represent both negative and positive exponents. (e.g., a stored value of 1023 indicates e=0) positive exponents. (e.g., a stored value of 1023 indicates e=0)

Not saved!

Concepts of Numerical Analysis

Floating point representation in computer

• OverflowOverflow: : A number is too large to fit into the floating-point system in use. FATALFATAL!

• UnderflowUnderflow: The exponent is less than the smallest possible (-1023 in IEEE 754). Nonfatal: sets the number to 0.

• Machine precision (eps): 0.5*2^(1-t)

Concepts of Numerical Analysis

Floating point representation in computer

How to avoid roundoff error accumulation and cancellation error

• If x and y have markedly different magnitudes, then x+y has a large absolute error

• If |y|<<1, then x/y has large relative and absolute errors. The same is true for xy if |y|>>1

• If x y, then x-y has a large relative error (cancellation error)

Concepts of Numerical Analysis

The ill-posed problem: The problem is sensitive to small error

Example: Consider evaluating the integrals

dxx

xy

n

n

1

0 10n=0,1,2,…25

10ln11ln0 y

1101

nn yn

y n=1,2,3,…25

Concepts of Numerical Analysis

The ill-posed problem: The problem is sensitive to small error

y=zeros(1,26); %allocate memory for y

y(1)=log(11)-log(10); %y0for n=2:26,y(n)=1/(n-1)-10*y(n-1);endplot(0:25,y)

0 5 10 15 20 25-2

0

2

4

6

8

10x 10

8