Code from paper: Modeling Metabolic State Transitions in Obesity Using a Time-Varying Lambda–Omega Framework
This repository contains MATLAB scripts for simulating and visualizing time-varying lambda–omega dynamical systems under three different scenarios. The code generates animated phase-plane trajectories together with a time-series summary of peak amplitudes and cumulative peak-to-peak changes, and can optionally export each simulation as an .mp4 movie.
The main goal of these scripts is to illustrate how changes in the radial growth term affect the system’s stability structure, nullclines, and limit-cycle behavior over time.
The repository includes three main simulation cases:
case_1.m— sign-flip transition from stable oscillation to decaycase_2.m— growing limit cyclecase_3.m— shrinking limit cycle
Each script:
- solves a lambda–omega system using
ode45 - animates the trajectory in the phase plane
- updates the vector field and nullclines over time
- tracks peaks of
$x(t)$ - computes the cumulative absolute change between consecutive peaks
- highlights an adaptation window based on peak differences
- optionally saves the animation as a video
The simulations are based on the planar lambda–omega system
where
Here:
-
$\Lambda(r,t)$ controls radial growth or decay -
$\Omega(r,t)$ controls angular velocity
Depending on how
- a stable limit cycle
- a shrinking oscillation
- a growing oscillation
- a transition from oscillatory to non-oscillatory behavior
Each simulation uses a two-panel figure.
Shows:
- trajectory in
$(x,y)$ - moving current state
- dynamic nullclines
- frozen nullcline snapshots at selected intervals
- vector field
- background shading indicating radial stability
Shows:
- peak values of
$x(t)$ - cumulative absolute differences between consecutive peaks
- shaded adaptation region based on peak-change thresholding
File: case_1.m
This case uses a lambda–omega model with a time-varying sign change in the radial term:
where
The sign function
- Initially the system supports a stable oscillation
- Over time the sign flip reverses the radial stability
- The oscillation weakens and eventually collapses toward the origin
- smooth transition in system stability
- deformation of nullclines during the transition
- reduction in oscillation amplitude over time
- detection of the adaptation period from peak differences
- animated phase portrait
- peak evolution over time
- cumulative peak-change curve
- optional movie export: Movie/case_1_movie.mp4
File: case_2.m
This case uses an order-2 lambda–omega system
The target limit-cycle radius grows smoothly over time.
The desired radius evolves as
The time-dependent radial parameter is
- the oscillation begins with a small radius
- the target radius increases gradually
- the trajectory expands outward until it reaches the larger limit cycle
- gradual outward growth of oscillation amplitude
- time-varying nullclines associated with expanding amplitude
- increasing peak structure during transient adaptation
- stabilization onto a larger oscillatory orbit
- animated phase portrait
- peak evolution over time
- cumulative peak-change curve
- optional movie export: Movie/case_2_movie.mp4
File: case_3.m
This case uses the same order-2 lambda–omega system as Case 2, but the target limit-cycle radius shrinks smoothly over time.
The radius evolves as
The radial parameter remains
- the oscillation starts on a large initial limit cycle
- the target radius decreases gradually
- the trajectory contracts inward toward a smaller stable cycle
- inward contraction of oscillatory behavior
- time-varying nullcline motion during shrinking dynamics
- transient adaptation visible in peak amplitudes
- convergence onto a smaller oscillatory orbit
- animated phase portrait
- peak evolution over time
- cumulative peak-change curve
- optional movie export: Movie/case_3_movie.mp4