Mathematical Modeling of Continuous-Time Systems
Mathematical modeling is the translation step between a physical story and a simulation. A tank fills, a mass moves, a capacitor charges, a population grows, or a reactor heats up; the modeler chooses state variables, writes conservation laws, introduces constitutive relations, and obtains algebraic or differential equations that can be solved numerically. In continuous system simulation the central object is usually an ordinary differential equation, because the state evolves over a continuum of time values.
The point of the model is not to reproduce every detail of the real system. A useful simulation model keeps the mechanisms that matter for the question being asked and omits details whose effects are small, unknown, or outside the intended operating range. Klee and Allen's text emphasizes this modeling-to-simulation path: begin with physical laws, turn them into equations, and then replace the continuous equation by a discrete-time numerical procedure that MATLAB or Simulink can execute.
Definitions
A continuous-time dynamical system has variables that are functions of real-valued time . A scalar first-order model has the form
where is the state, is an input, is an output, and the dot denotes . A vector model stacks several states:
A state is a minimum set of variables that, together with future inputs, determines future behavior. For a mechanical mass-spring-damper, position alone is not enough because two systems at the same position can move differently if their velocities differ. A good state choice is and .
A conservation law says that accumulation equals inflow minus outflow plus generation. In lumped models this often appears as
Constitutive laws relate effort-like and flow-like variables. Examples include Ohm's law , Hooke's law , viscous friction , and Newton's cooling law . Constitutive relations close the model by replacing vague physical phrases with equations.
A lumped-parameter model assumes spatial variation inside each element can be summarized by a finite number of variables. A distributed-parameter model keeps spatial dependence and leads to partial differential equations. Continuous system simulation often begins with lumped approximations even when the physical system is distributed, because ordinary differential equations are easier to simulate and interpret.
Key results
The most useful modeling pattern is the balance equation. If is the stored quantity and is the chosen state, then
When is proportional to , the model is first order. For a tank with constant cross-sectional area , stored volume is , so
If the outlet relation is linearized as , then
This is the same mathematical form as an RC circuit,
which is why simulation methods transfer across domains.
Dimensional consistency is a non-negotiable check. If the left-hand side has units of meters per second, every term on the right-hand side must also reduce to meters per second. This check catches sign errors, missing capacitances or masses, and accidental use of total quantities where rates are required.
Equilibrium points are obtained by setting derivatives to zero. For an autonomous system with constant input , an equilibrium satisfies
Equilibria matter because simulations are often run as deviations from a steady operating condition. They also provide a way to check whether long-time numerical results make physical sense.
Visual
| Modeling decision | Typical choice | Simulation consequence |
|---|---|---|
| Boundary | Include only components needed for the question | Determines inputs, outputs, and neglected dynamics |
| State variables | Stored energy or material variables | Determines order of ODE system |
| Constitutive law | Linear, nonlinear, empirical, or table-based | Determines whether linear tools apply |
| Parameter treatment | Constant, scheduled, random, or estimated | Affects validation and sensitivity studies |
| Initial condition | Measured, equilibrium, or assumed | Strongly affects transients |
Worked example 1: Draining tank with a linear outlet
Problem: A tank has cross-sectional area and a linear hydraulic resistance . A constant inflow begins at . The initial height is . Derive the model, find the equilibrium, and predict the qualitative time-response plot.
-
Choose the state. The stored volume is , so the water height is sufficient if the tank is well mixed and the area is constant.
-
Write the volume balance:
- Substitute and :
- Divide by :
- Find the equilibrium by setting :
- Solve the first-order response:
Checked answer: and . The time-response plot should be a monotone rising exponential with time constant , initially steep and then flattening as the outlet flow increases.
Simulink description: use a Sum block for , a Gain block , an Integrator block for , and a feedback Gain block from to the negative input of the Sum. A Scope should show the same rising exponential.
Worked example 2: Mass-spring-damper model from Newton's law
Problem: A cart of mass is attached to a spring and a damper . An external force acts on the cart. Let displacement be measured from the spring's unstretched position. Derive a first-order state model and find the equilibrium for a constant force .
- Choose states. A second-order mechanical equation needs position and velocity:
- Apply Newton's second law. The forces are external force , spring force , and damping force :
- Substitute parameter values:
- Convert to state equations:
- For constant , set . From , . Then
so
Checked answer: a static spring under extends , matching the state calculation. The time-response plot for a force step should approach with decaying oscillation or monotone decay depending on damping. Here and , so the plot is underdamped.
Simulink description: build two cascaded Integrator blocks for acceleration to velocity to position. Sum , , and , multiply by , and feed the acceleration integrator. Scope the position and velocity states.
Code
% Draining tank and mass-spring-damper simulations.
clear; clc; close all;
% Tank parameters
A = 2;
Rh = 5;
qin = 0.4;
h0 = 0.5;
tspan = [0 60];
tank_rhs = @(t,h) (qin - h/Rh)/A;
[tt, hh] = ode45(tank_rhs, tspan, h0);
% Mechanical parameters
m = 4;
b = 6;
k = 20;
F0 = 10;
x0 = [0; 0];
mech_rhs = @(t,x) [x(2); (F0 - b*x(2) - k*x(1))/m];
[tm, xm] = ode45(mech_rhs, [0 10], x0);
figure;
subplot(2,1,1);
plot(tt, hh, 'LineWidth', 1.5); grid on;
xlabel('Time (s)'); ylabel('Height h (m)');
title('Tank response: monotone approach to equilibrium');
subplot(2,1,2);
plot(tm, xm(:,1), 'LineWidth', 1.5); grid on;
xlabel('Time (s)'); ylabel('Position q (m)');
title('Mass-spring-damper step response');
The first plot should rise smoothly from toward . The second should oscillate around with a decaying envelope because the damping ratio is less than one. In Simulink the same responses appear if the integrator initial conditions are set to the stated initial states and the force or inflow is represented with Constant or Step blocks.
Common pitfalls
- Choosing outputs as states when they do not contain enough memory. Position without velocity is not a complete mechanical state.
- Mixing total stored quantities and rates. A flow rate belongs on the right side of a balance equation; a stored amount belongs inside the derivative.
- Forgetting sign conventions. Pick positive directions once, then make spring, damping, and outflow terms oppose the stored variable or motion when physics says they should.
- Treating nonlinear outlet or friction laws as linear without saying so. Linear models are local approximations unless the physical law is truly linear over the full range.
- Running MATLAB before checking units. Numerical solvers can integrate dimensionally impossible equations without warning.
- Setting all initial conditions to zero by habit. A wrong initial condition can make a correct model look wrong during the transient.