Computer Simulations and Modeling for Medicine: Principles, Methodologies, and Applications

Course Structure, Administration, and Objectives

  • Course Identification:

    • Course Name: Computer Simulations and Modeling for Medicine

    • Course Code: EENG514

    • Academic Cycle: 2026–2027

  • Master Course Grading System:

    • Participation: 10%10\%

    • Project: 15%15\%

    • Midterm Examination: 40%40\%

    • Final Examination: 50%50\%

  • Core Course Goals:

    • Introduce the fundamental concepts of biological system modeling and computer simulation.

    • Identify and model biological systems across various physiological domains.

    • Apply mathematical algorithms and software packages to simulate biological processes.

    • Validate simulation models using empirical data and rigorous analytical procedures.

  • Required Textbooks:

    • Claudio Cobelli and Ewart Carson, Introduction to Modeling in Physiology and Medicine, First Edition, Elsevier, 2008.

    • Frank C. Hoppensteadt and Charles S. Peskin, Modeling and Simulation in Medicine and Life Sciences, Second Edition, Springer, 2002.

Fundamentals and Foundations of Modeling

  • Definition of a Model:

    • A model is defined as an explicit representation of reality that inherently involves some degree of approximation.

    • Models simplify complex physical phenomena to isolate key functional relationships and mechanisms.

    • Example: Modeling the hydrodynamic mechanisms through which blood is pumped throughout the circulatory network by the mechanical action of the heart.

  • Modalities and Forms of Models:

    • Models manifest across multiple qualitative and quantitative formats, including mathematical, conceptual, mental, verbal, physical, statistical, logical, and graphical models.

    • Verbal Model Example: A detailed descriptive exposition in a physiology textbook describing alveolar gas exchange occurring during inhalation and exhalation.

    • Graphical Model Example: A coordinate plot displaying dynamic drug plasma concentration as a function of elapsed time.

  • The General Modeling Pipeline:

    • The operational progression begins with an observable physical or biological system, transitions through an established modeling methodology, and culminates in a functional model.


General Modeling Pipeline

System Representation and the Purposes of Modeling

  • System Input-Output Abstraction:

    • A system can be represented mathematically and conceptually as an enclosed entity or "black box" denoted by SS.

    • The stimulus or input acting upon the system is designated as the excitation, EE.

    • The resulting output generated by the system is designated as the response, RR.


System Excitation and Response Block Diagram
  • Classification of Engineering and Scientific Problems:

    • Synthesis Problems:

    • Given quantities: Excitation (EE) and Response (RR).

    • Objective / Quantity to find: System structure and parameters (SS).

    • Primary technical utility: Understanding; using documented knowledge of external inputs and outputs to infer internal system characteristics.

    • Analysis Problems:

    • Given quantities: Excitation (EE) and System characteristics (SS).

    • Objective / Quantity to find: Response (RR).

    • Primary technical utility: Prediction; using structural knowledge of component parts and applied stimuli to observe, compute, or forecast responses.

    • Instrumentation Problems:

    • Given quantities: System characteristics (SS) and Response (RR).

    • Objective / Quantity to find: Excitation (EE).

    • Primary technical utility: Control; designing, constraining, or driving a system such that a specified target output is produced in response to an input.

  • Primary Objectives of the Modeling Process:

    • Understanding: Establishing qualitative or quantitative comprehension of either a real physical system or an idealized conceptual construct.

    • Prediction: Projecting the future progression or determining an unknown internal state of a system.

    • Control: Constraining, manipulating, or regulating a system to achieve a stable or desirable operational condition.

    • Methodological Guideline: The specific purpose of the modeling effort serves as the primary driver governing the selected modeling methodology.

Constraints and Inherent Trade-offs on Model Structure

  • The Three Structural Constraints:

    • Realism: The extent to which the internal structure and mathematical operations of the model faithfully mimic the biological and physical mechanisms of the real world.

    • Precision: The numerical accuracy and fidelity of model outputs relative to empirical observations.

    • Generality: The breadth of systems, environmental conditions, and biological contexts to which the model correctly applies.

  • The Fundamental Optimization Trade-off:

    • No single model can maximize realism, precision, and generality simultaneously.

    • Prioritizing any single attribute inevitably forces a quantifiable compromise or reduction in the remaining two attributes.

  • Trade-off Hierarchy Across Primary Modeling Purposes:

    • Prediction:

    • Great (Highest priority): Precision

    • Less (Moderate priority): Realism

    • Even less (Lowest priority): Generality

    • Understanding:

    • Great (Highest priority): Generality

    • Less (Moderate priority): Realism

    • Even less (Lowest priority): Precision

    • Control:

    • Great (Highest priority): Realism

    • Less (Moderate priority): Precision

    • Even less (Lowest priority): Generality

Classification Frameworks for Mathematical Models

  • Mechanistic Representation (Quantitative vs. Qualitative):

    • Quantitative Models (Mechanistic or Process-Oriented):

    • Explicitly represent theoretical, biophysical mechanisms using mathematical equations.

    • Serve as the foundational focus in physiological systems engineering.

    • Qualitative Models (Descriptive or Phenomenological):

    • Lack explicit mechanistic mathematical equations, summarizing observed behavior empirically.

    • Examples: Surface topography descriptions of a biomaterial; verbal/heuristic associations such as stating that an elevation in blood volume induces an increase in blood pressure.

  • Temporal State Representation (Dynamic vs. Static):

    • Dynamic Models:

    • Explicitly represent time-varying system states and conditions.

    • Formulated via differential or difference equations tracking physiological variables over time.

    • Example: The Windkessel circulatory model describing the systemic arterial vascular tree via dynamic pressure-flow relationships.

    • Static Models:

    • Assume steady-state conditions without tracking time-dependent transitions.

    • Example: Steady-state algebraic equations relating volumetric blood flow rate through an isolated vessel to the longitudinal hydrostatic pressure drop along its length.

  • Continuity of Time (Continuous vs. Discrete):

    • Continuous Models:

    • Time is formulated as a continuum (t∈Rt \in \mathbb{R}), allowing temporal variables to take any fractional value (e.g., t=3.3 sect = 3.3\,\text{sec}).

    • Discrete Models:

    • Time advances in finite, quantized steps or integers (t∈Zt \in \mathbb{Z}), evaluating system states at distinct epochal intervals.

  • Determinism vs. Randomness (Deterministic vs. Stochastic):

    • Stochastic Models:

    • Incorporate probabilistic components, random variables, and noise distributions to capture random events.

    • Essential for microscopic phenomena, such as ion channel gating, molecular diffusion, and stochastic cellular signaling.

    • Deterministic Models:

    • Contain no random variables; given identical initial conditions and parameter sets, identical outputs are produced every time.

    • Repeatable, analytically tractable, and simpler to analyze.

Methodological Modeling Paradigms

  • Two Primary Methodological Approaches:

    • Data-Driven (Black-Box) Modeling:

    • Identifies input-output mathematical transfer functions derived strictly from experimental data without explicitly modeling internal physical components.

    • Physiological System (Mechanistic / White-Box) Modeling:

    • Explicitly delineates and couples the known physical, mechanical, and anatomical components of the system.

    • Classic Example: Hill's classic muscle model.

  • Hill's Three-Element Muscle Model Structure:

    • Decomposes active and passive mechanical behavior of skeletal muscle under tension (FF) into distinct mechanical components:

    • Contractile Element (CECE): Represents active actin-myosin cross-bridge force generation.

    • Series Elastic Element (SESE): Accounts for tendon and internal sarcomere elasticity positioned in mechanical series with CECE.

    • Parallel Elastic Element (PEPE): Captures passive elastic recoil from muscle connective tissue (fascia, epimysium, perimysium) positioned in parallel with the CE−SECE-SE branch.


Hill's Muscle Model Diagram

Data-Driven (Black-Box) Modeling: Theory and Biological Rhythm Example

  • Methodology Flowchart for Black-Box Formulations:

    • The physiological system produces observable experimental data.

    • Guided by the defined modeling purpose, a chosen empirical model structure (input-output representation) and parameter estimation techniques are combined to produce the final model.


Data-Driven Modeling Methodology
  • Biological Rhythm Case Study: Human Menstrual Cycle Thermoregulation:

    • Biological Basis: Basal body temperature undergoes a periodic rhythm corresponding to the female menstrual cycle.

    • Experimental Dataset: Data collected daily over a period of almost one year, with experimental measurements missing/omitted on 94 days94\,\text{days}.

    • Model Structure (McIntosh and McIntosh, 1980): Periodic variation modeled via a four-parameter sinusoidal function:     y=A1sin⁡[6.2832(A2+t)A3]+A4y = A_1 \sin\left[\frac{6.2832(A_2 + t)}{A_3}\right] + A_4

    • yy: Dependent variable representing core body temperature (∘C^{\circ}\text{C}

    • tt: Independent variable representing elapsed time (days\text{days}

    • 6.28326.2832: Numerical constant representing 2π2\pi

    • A1A_1: Peak amplitude of the sinusoidal temperature fluctuation

    • A2A_2: Temporal phase synchronization parameter aligning the model curve with empirical time-series data

    • A3A_3: Period of the cycle (distance in days between consecutive temperature peaks)

    • A4A_4: Baseline displacement offset representing the central mean temperature value

  • Fitted Parameter Values (Mean ±\pm Standard Deviation):

    • Amplitude: A1=0.191±0.011 ∘CA_1 = 0.191 \pm 0.011\,^{\circ}\text{C}

    • Phase Shift: A2=12.85±0.47 daysA_2 = 12.85 \pm 0.47\,\text{days}

    • Period: A3=27.07±0.07 daysA_3 = 27.07 \pm 0.07\,\text{days}

    • Mean Offset: A4=36.56±0.008 ∘CA_4 = 36.56 \pm 0.008\,^{\circ}\text{C}


Fitted Sinusoidal Menstrual Temperature Model

Mechanistic Modeling: The Two-Element Windkessel Model

  • Methodology for Mechanistic System Modeling:

    • Expands upon data-driven approaches by incorporating theoretical A priori knowledge (e.g., physical laws of mass, energy, and momentum conservation) alongside explicitly stated biophysical Assumptions.


System Modeling Methodology Flowchart
  • Biophysical Conceptualization:

    • Conceptualizes the large systemic elastic arteries (primarily the ascending aorta and arch) as an elastic compliance reservoir with fluid storage capacity.

    • Pulsatile ejection from the left ventricle introduces periodic blood volume into the elastic chamber, which subsequently discharges blood through peripheral vascular resistance into the low-pressure venous bed.


Windkessel Model Conceptual Diagram
  • Mathematical Derivation:

    • Arterial Compliance Definition: Total arterial compliance (CC) defines vessel elasticity as incremental volumetric change per unit change in distending pressure:     C=dV(t)dP(t)C = \frac{dV(t)}{dP(t)}

    • Assumption: Assuming a linear relationship between arterial volume and distending pressure, CC remains constant throughout the cardiac cycle.

    • Conservation of Mass (Fluid Continuity Equation):

    • Total volumetric inflow rate (Q˙in(t)\dot{Q}_{in}(t)) entering the aorta from the left ventricle equals the rate of dynamic volume storage (dV(t)dt\frac{dV(t)}{dt}) plus peripheral vascular outflow (Q˙out(t)\dot{Q}_{out}(t)):       Q˙in(t)=dV(t)dt+Q˙out(t)\dot{Q}_{in}(t) = \frac{dV(t)}{dt} + \dot{Q}_{out}(t)

    • Substituting the chain rule expression for volume storage (dV(t)dt=dVdPdP(t)dt=CdP(t)dt\frac{dV(t)}{dt} = \frac{dV}{dP} \frac{dP(t)}{dt} = C \frac{dP(t)}{dt}):       Q˙in(t)=CdP(t)dt+Q˙out(t)\dot{Q}_{in}(t) = C \frac{dP(t)}{dt} + \dot{Q}_{out}(t)

    • Peripheral Runoff (Poiseuille / Ohm's Analogy):

    • Outflow (Q˙out(t)\dot{Q}_{out}(t)) into the capillary bed is directly proportional to the arterio-venous pressure gradient (P(t)P(t)) divided by total peripheral resistance (RR):       Q˙out(t)=P(t)R\dot{Q}_{out}(t) = \frac{P(t)}{R}

    • General Governing Differential Equation:     Q˙in(t)=CdP(t)dt+P(t)R\dot{Q}_{in}(t) = C \frac{dP(t)}{dt} + \frac{P(t)}{R}

  • Diastolic Pressure Dynamics and Analytical Solution:

    • Physiological Condition: During ventricular diastole, the aortic valve is closed. Ventricular ejection ceases completely, meaning arterial inflow is zero:     Q˙in(t)=0\dot{Q}_{in}(t) = 0

    • Boundary Parameters:

    • Let t∗t^* denote the exact time at which ventricular ejection terminates (aortic valve closure / dicrotic notch).

    • Let TT denote the total period of a single complete cardiac cycle.

    • Diastolic Homogeneous Differential Equation:     CdP(t)dt+P(t)R=0,t∗<t<TC \frac{dP(t)}{dt} + \frac{P(t)}{R} = 0, \quad t^* < t < T

    • Analytical Solution for Arterial Diastolic Pressure:     P(t)=P∗exp⁡[−t−t∗τ],t∗<t<TP(t) = P^* \exp\left[-\frac{t - t^*}{\tau}\right], \quad t^* < t < T

    • P∗=P(t∗)P^* = P(t^*): Arterial blood pressure at the moment ventricular ejection ceases

    • τ=RC\tau = RC: Arterial hydrodynamic time constant, characterizing the exponential rate of diastolic pressure runoff

Computer Simulation and Control in Medicine

  • Definition and Scope of Simulation:

    • A simulation is an experiment performed computationally on a model rather than a living biological specimen.

    • Entails executing numerical computations on an assumed mathematical model to predict or optimize real-world clinical and physiological scenarios.

  • Requisite Technical Disciplines:

    • Mathematical modeling skills (formulating governing differential and algebraic equations).

    • Computer science and software engineering skills (algorithm design, numerical solvers, and programming).

    • Data analysis and statistical inference skills (parameter estimation and validation).

  • Clinical and Practical Advantages:

    • Significantly reduces monetary expense.

    • Compresses or accelerates experimental timeframes.

    • Overcomes ethical and practical accessibility constraints inherent in human and animal in vivo research.

    • Permits safe, rapid, and reproducible manipulation of physiological parameters.

  • Simulink Control Architecture: Closed-Loop Ventilator Case Study:

    • Utilizes a closed-loop negative feedback architecture implemented in MATLAB/Simulink.

    • Reference Pressure (PrefP_{ref}) serves as the desired target setpoint.

    • Error Signal Generation: An algebraic subtraction junction compares PrefP_{ref} with the delayed output feedback signal supplied via a unit delay memory block (Memory2).

    • Dual Error Derivative Input: The instantaneous error and its temporal difference (computed via Memory1 and a subtraction block) feed into a multi-input Fuzzy Logic Controller.

    • Actuation System: Output control signals from the fuzzy controller pass to the physical Ventilator block (inputs In1, generating outputs Out1 and Out2).

    • Biological Plant Dynamics: The patient's lung mechanics are represented by a first-order continuous-time transfer function block labeled patient2:     G(s)=12s+10G(s) = \frac{1}{2s + 10}

    • Signal Monitoring: Digital oscilloscope blocks (Scope, Scope1, Scope2, Scope4, Scope5) are positioned across the system to monitor error states, control signals, and patient airway pressure profiles.


Simulink Closed Loop Ventilator Fuzzy Logic Control Diagram

Curve Fitting and Empirical Model Estimation

  • Operational Definition of Curve Fitting:

    • Curve fitting is the mathematical procedure of determining an optimal mathematical equation that expresses the functional relationship between a dependent variable (YY) and an independent variable (XX).

    • Utilizes nonlinear regression algorithms to minimize residual error and iteratively estimate model parameters (A,B,C,D,…A, B, C, D, \dots).


Nonlinear Curve Fitting Example Plot
  • Standard Library of Mathematical Regression Models:

    • Model 1 (Simple Linear):     Y=A+BXY = A + BX

    • Model 2 (Quadratic Polynomial):     Y=A+BX+CX2Y = A + BX + CX^2

    • Model 3 (Cubic Polynomial):     Y=A+BX+CX2+DX3Y = A + BX + CX^2 + DX^3

    • Model 4 (Rational Polynomial Ratio 1,1):     Y=A+BX1+CXY = \frac{A + BX}{1 + CX}

    • Model 5 (Rational Polynomial Ratio 2,2):     Y=A+BX+CX21+DX+EX2Y = \frac{A + BX + CX^2}{1 + DX + EX^2}

    • Model 6 (Rational Polynomial Ratio 3,3):     Y=A+BX+CX2+DX31+EX+FX2+GX3Y = \frac{A + BX + CX^2 + DX^3}{1 + EX + FX^2 + GX^3}

    • Model 7 (Rational Polynomial Ratio 4,4):     Y=A+BX+CX2+DX3+EX41+FX+GX2+HX3+IX4Y = \frac{A + BX + CX^2 + DX^3 + EX^4}{1 + FX + GX^2 + HX^3 + IX^4}

    • Model 8 (Michaelis-Menten Kinetics):     Y=AXB+XY = \frac{AX}{B + X}

    • Model 9 (Reciprocal):     Y=1A+BXY = \frac{1}{A + BX}

    • Model 10 (Bleasdale-Nelder):     Y=(A+BX)−1CY = (A + BX)^{-\frac{1}{C}}

    • Model 11 (Farazdaghi and Harris):     Y=1A+BXCY = \frac{1}{A + BX^C}

    • Model 12 (Holliday):     Y=1A+BX+CX2Y = \frac{1}{A + BX + CX^2}

    • Model 13 (Exponential Growth/Decay):     Y=exp⁡(A(X−B))Y = \exp(A(X - B))

    • Model 14 (Monomolecular Growth):     Y=A(1−exp⁡(−B(X−C)))Y = A(1 - \exp(-B(X - C)))

    • Model 15 (Three-Parameter Logistic):     Y=A1+Bexp⁡(−CX)Y = \frac{A}{1 + B\exp(-CX)}

    • Model 16 (Four-Parameter Logistic):     Y=D+A−D1+Bexp⁡(−CX)Y = D + \frac{A - D}{1 + B\exp(-CX)}

    • Model 17 (Gompertz Growth):     Y=Aexp⁡(−exp⁡(−B(X−C)))Y = A\exp(-\exp(-B(X - C)))

    • Model 18 (Weibull Function):     Y=A−(A−B)exp⁡(−(C∣X∣)D)Y = A - (A - B)\exp(-(C|X|)^D)

    • Model 19 (Morgan-Mercer-Floding):     Y=A−A−B1+(C∣X∣)DY = A - \frac{A - B}{1 + (C|X|)^D}

    • Model 20 (Richards Function):     Y=A[1+(B−1)exp⁡(−C(X−D))]11−BY = A\left[1 + (B - 1)\exp(-C(X - D))\right]^{\frac{1}{1 - B}}

    • Model 21 (Logarithmic):     Y=Bln⁡(∣X∣−A)Y = B\ln(|X| - A)

    • Model 22 (Power Function):     Y=A(1−BX)Y = A(1 - B^X)

    • Model 23 (Power Raised to Power):     Y=AXBXCY = A X^{B X^C}

    • Model 24 (Sum of Exponentials):     Y=Aexp⁡(−BX)+Cexp⁡(−DX)Y = A\exp(-BX) + C\exp(-DX)

    • Model 25 (Exponential Type 1):     Y=AXBexp⁡(−CX)Y = A X^B \exp(-CX)

    • Model 26 (Exponential Type 2):     Y=(A+BX)exp⁡(−CX)+DY = (A + BX)\exp(-CX) + D

    • Model 27 (Normal / Gaussian Distribution):     Y=A+Bexp⁡(−C(X−D)2)Y = A + B\exp(-C(X - D)^2)

    • Model 28 (Lognormal Distribution):     Y=A+(BX)exp⁡(−C(ln⁡(∣X∣)−D)2)Y = A + \left(\frac{B}{X}\right)\exp(-C(\ln(|X|) - D)^2)

    • Model 29 (Simple Exponential):     Y=Aexp⁡(−BX)Y = A\exp(-BX)

    • Model 30 (Dual Michaelis-Menten / Michaelis-Menten 2):     Y=AXB+X+CXD+XY = \frac{AX}{B + X} + \frac{CX}{D + X}

  • Empirical Curve Fitting Implementation in Spreadsheets:

    • Data Configuration: Bivariate series mapping independent production/activity values (Units\text{Units}, XX) to monetary expenditure (Cost\text{Cost}, YY).

    • Complete Tabular Dataset:

    • X=10X = 10, Y=8449Y = 8449

    • X=20X = 20, Y=6751Y = 6751

    • X=30X = 30, Y=5257Y = 5257

    • X=40X = 40, Y=3984Y = 3984

    • X=50X = 50, Y=2805Y = 2805

    • X=60X = 60, Y=1994Y = 1994

    • X=70X = 70, Y=1265Y = 1265

    • X=80X = 80, Y=624Y = 624

    • X=90X = 90, Y=442Y = 442

    • X=100X = 100, Y=299Y = 299

    • X=110X = 110, Y=304Y = 304

    • X=120X = 120, Y=685Y = 685

    • X=130X = 130, Y=1109Y = 1109

    • X=140X = 140, Y=1809Y = 1809

    • X=150X = 150, Y=2859Y = 2859

    • X=160X = 160, Y=3819Y = 3819

    • X=170X = 170, Y=5131Y = 5131

    • X=180X = 180, Y=6653Y = 6653

    • X=190X = 190, Y=7369Y = 7369

    • X=200X = 200, Y=8291Y = 8291

    • Regression Analysis Output: Polynomial regression identifies a parabolic convex cost curve governed by the quadratic model:     y=0.918x2−187.58x+10017y = 0.918x^2 - 187.58x + 10017


Excel Quadratic Polynomial Regression Cost Fit