Engineering Mathematics III

Chapter 1
Mathematical Modeling and Computational Foundations

Bachelor Program in Mechatronics Engineering
Engineering Mathematics III   •   Bachelor

Mathematical Modeling and Computational Foundations

Introduction

Mechatronics engineering combines mechanics, electronics, control, computation, and materials into integrated systems. A mathematical model provides the language for describing such systems before they are built, tested, or controlled. Models allow an engineer to predict motion, estimate forces, simulate electrical responses, identify sensitivities, and design controllers.

This chapter reviews the mathematical tools required to construct and analyze such models. The emphasis is not merely on manipulating equations, but on deciding what variables matter, identifying assumptions, preserving dimensional consistency, selecting suitable approximations, and implementing calculations reproducibly with MATLAB, Python, or equivalent software.

A model is a purposeful representation of a real system. It is never the system itself. A useful model is sufficiently accurate for its intended purpose while remaining understandable and computationally manageable.

Learning Objectives

By the end of this chapter, the reader should be able to:

  1. Distinguish scalar, vector, and matrix representations used in engineering models.
  2. Interpret functions, partial derivatives, gradients, Jacobians, and linear approximations.
  3. Use matrix operations, determinants, inverses, eigenvalues, and eigenvectors appropriately.
  4. Formulate continuous-time and discrete-time models from physical laws.
  5. Check equations for dimensional consistency and select meaningful scales.
  6. Apply approximation methods while recognizing their assumptions and limitations.
  7. Implement reproducible mathematical analysis using MATLAB or Python.
  8. Assess model quality through validation, sensitivity analysis, and uncertainty awareness.

1. Mathematical Models in Mechatronics

A model normally consists of:

  • Inputs, such as voltage, force, torque, or commanded position;
  • States, which describe the internal condition of a system;
  • Parameters, such as mass, resistance, stiffness, or damping;
  • Outputs, which are measured or otherwise required quantities;
  • Relationships, usually algebraic, differential, or difference equations.

For example, a translational mass–spring–damper system can be represented by Newton’s second law:

m d²x/dt² + c dx/dt + kx = F(t)

Here, m is mass in kilograms, c is viscous damping in newton-seconds per metre, k is stiffness in newtons per metre, x(t) is displacement in metres, and F(t) is applied force in newtons. The equation assumes a linear spring, viscous damping, constant parameters, and one-dimensional motion.

The equation is dimensionally consistent: each term has units of newtons. A model may be continuous, as above, or discrete, in which variables are defined at sampling instants.

Model purposes

Different purposes require different model detail. A controller may need a low-order dynamic model; a structural analysis may require a finite-element model; a real-time embedded system may require a computationally inexpensive approximation. Model selection is therefore an engineering decision involving accuracy, cost, and risk.

2. Functions, Variables, and State Descriptions

A function maps inputs to outputs. A scalar function of one variable is written as y = f(x). A multivariable function may be written as z = f(x,y), while a vector-valued function is written as y = f(x), where both x and y may be vectors.

In mechatronics, a system may be described by the state vector

x(t) = [ q(t) v(t) i(t) ]ᵀ

where q may be position, v velocity, and i current. A state is a minimum set of variables that, together with future inputs, determines future system behavior under the model assumptions.

A general continuous-time state-space model is

dx/dt = f(x,u,t), y = g(x,u,t)

where x is the state vector, u the input vector, y the output vector, and f and g vector-valued functions. For a linear time-invariant system, this becomes

dx/dt = Ax + Bu, y = Cx + Du

The matrices A, B, C, and D must have compatible dimensions. If x has n components and u has m components, then A is n×n, B is n×m, C is p×n, and D is p×m for p outputs.

3. Matrices and Linear Algebra

A matrix is a rectangular array of numbers. Matrices represent multiple equations, coordinate transformations, system parameters, and datasets. For

A = [ a₁₁ a₁₂ ; a₂₁ a₂₂ ]

matrix addition requires equal dimensions. Matrix multiplication is defined when the number of columns of the first matrix equals the number of rows of the second. In general, multiplication is not commutative: AB ≠ BA.

A linear system is written as

Ax = b

where A is the coefficient matrix, x the unknown vector, and b the known vector. When A is square and nonsingular, the system has a unique solution. Although the formal expression x = A⁻¹b is mathematically valid, numerical software should normally solve the system directly rather than explicitly calculating A⁻¹, because direct solution is generally more efficient and numerically stable.

For a 2 × 2 matrix,

det(A) = a₁₁a₂₂ − a₁₂a₂₁

If the determinant is zero, the matrix is singular and has no ordinary inverse. A very small determinant may indicate ill-conditioning, but determinant magnitude alone is not a reliable general measure of numerical sensitivity.

Eigenvalues and eigenvectors

An eigenvector v of a square matrix A satisfies

Av = λv

where λ is the corresponding eigenvalue and v ≠ 0. Equivalently,

det(A − λI) = 0

where I is the identity matrix. Eigenvalues are especially important in dynamics. For the linear system dx/dt = Ax, an eigenvalue with a negative real part corresponds to a decaying mode, a positive real part to a growing mode, and a zero real part requires further analysis. For continuous-time asymptotic stability, all eigenvalues must have strictly negative real parts. For a discrete model xk+1 = Adxk, asymptotic stability requires all eigenvalues of Ad to lie strictly inside the unit circle: |λ| < 1.

Worked Example 1: Eigenvalues of a dynamic matrix

Consider

A = [ 0 1 ; −4 −3 ]

The characteristic equation is

det(A − λI) = λ² + 3λ + 4 = 0

Thus

λ = (−3 ± √(9 − 16))/2 = (−3 ± i√7)/2

Both eigenvalues have real part −1.5, so the corresponding continuous-time linear system is asymptotically stable and exhibits decaying oscillation. The imaginary component determines the oscillatory part of the response, while the real component determines exponential decay.

4. Multivariable Differentiation and Linearization

For a scalar function f(x,y), the partial derivatives are

∂f/∂x = limh→0 [f(x+h,y) − f(x,y)]/h

and similarly for ∂f/∂y. A partial derivative measures local change with respect to one variable while holding the other variables constant.

The gradient is

∇f = [ ∂f/∂x ∂f/∂y ]ᵀ

It points in the direction of greatest local increase of f. For a vector function f:ℝⁿ→ℝᵐ, the Jacobian matrix is

J = ∂f/∂x = [ ∂fᵢ/∂xⱼ ]

with m rows and n columns. The Jacobian is central to robot kinematics, sensitivity analysis, nonlinear control, and numerical solution of nonlinear equations.

Near a nominal point x₀, a differentiable function can be approximated by

f(x₀ + Δx) ≈ f(x₀) + J(x₀)Δx

This first-order approximation is accurate when Δx is sufficiently small and the function is smooth near x₀. For a scalar function, the second-order approximation includes the Hessian matrix H:

f(x₀ + Δx) ≈ f(x₀) + ∇f(x₀)ᵀΔx + ½ΔxᵀH(x₀)Δx

The Hessian contains second partial derivatives. It is useful for curvature analysis and optimization, but its validity depends on adequate smoothness and a sufficiently local perturbation.

Worked Example 2: Linearizing a pendulum term

For a pendulum, the restoring torque includes mgl sin θ, where m is mass, g gravitational acceleration, l length, and θ angle in radians. Around the upright small-angle equilibrium θ = 0,

sin θ ≈ θ

so the torque is approximated by mglθ. This approximation follows from the Taylor expansion of sine and is accurate when |θ| is small. Radians are dimensionless, so the units remain torque: kilograms × metres per second squared × metres.

5. Dimensional Consistency and Scaling

Dimensional analysis is a fundamental error-detection method. Quantities with different physical dimensions cannot be added. Every term in an additive equation must have the same dimensions.

For the mass–spring–damper equation:

  • m d²x/dt² has units kg·m/s² = N;
  • c dx/dt has units (N·s/m)(m/s) = N;
  • kx has units (N/m)(m) = N.

The equation is therefore dimensionally consistent.

Units and dimensions are different. A metre and a foot are different units of the same dimension, length. Angle in radians is treated as dimensionless in dimensional analysis, although its numerical interpretation is important.

Buckingham π perspective

If a physical relationship involves n dimensional variables described using r independent fundamental dimensions, it can often be rewritten using n−r independent dimensionless groups. This principle supports scaling experiments and identifying governing nondimensional parameters. Its application requires correct identification of variables and independent dimensions; it does not by itself determine the functional relationship.

Nondimensionalization

Suppose position is scaled by L and time by T:

x = LX*, t = Tt*

where starred variables are dimensionless. Substitution into a governing equation can reveal relative importance of terms and reduce numerical conditioning problems. Characteristic scales should be selected from the physical problem, such as nominal length, velocity, voltage, or time constant.

Poor scaling can cause numerical algorithms to treat one variable as much more significant than another merely because of units. Rescaling variables is therefore both a physical and computational practice.

6. Approximation and Error

Approximation is unavoidable in engineering. Common approximations include:

sin θ ≈ θ, ex ≈ 1 + x, (1 + ε)n ≈ 1 + nε

The first two approximations require small arguments, and the last requires |ε| to be small. The neglected terms determine the error. For example,

sin θ = θ − θ³/6 + θ⁵/120 − ⋯

when θ is expressed in radians. Omitting the cubic term produces a leading error approximately |θ|³/6 for small θ. At θ = 0.1 rad, this estimate is about 0.000167 rad, or roughly 0.17% of the leading term.

Approximation error should be distinguished from measurement uncertainty, parameter uncertainty, and numerical round-off. A model can be mathematically solved to high numerical precision while still being physically inaccurate because its assumptions are poor.

7. From Physical Laws to Continuous Models

A reliable modeling procedure is:

  1. Define the system boundary and purpose.
  2. Select coordinates, inputs, outputs, and states.
  3. Draw a free-body diagram or circuit diagram where appropriate.
  4. State assumptions explicitly.
  5. Apply conservation laws and constitutive relations.
  6. Check signs, units, and limiting cases.
  7. Rearrange into a useful state-space or input–output form.
  8. Validate against measurements or known special cases.

Example: DC motor model

An idealized armature-controlled DC motor can be modeled by

J dω/dt = Kt i − bω − τL
L di/dt = V − Ri − Keω

where J is rotor inertia, ω angular speed, Kt torque constant, i armature current, b viscous friction coefficient, τL load torque, L inductance, V applied voltage, R resistance, and Ke back-emf constant. In SI units, Kt and Ke have numerically compatible values, though their physical units differ.

Choosing x = [ω, i]ᵀ and input u = V gives

dx/dt = [ −b/J Kt/J ; −Ke/L −R/L ]x + [ 0 ; 1/L ]u

if the load torque is treated as zero or as a separate disturbance input. The model assumes linear magnetic behavior, constant parameters, and viscous rather than Coulomb friction.

8. Discrete-Time Models and Sampling

Digital controllers operate at sampling times tk = kTs, where Ts is the sampling period. A simple forward-Euler discretization of

dx/dt = f(x,u,t)

is

xk+1 = xk + Ts f(xk,uk,tk)

This method is first-order accurate in Ts and may be unstable for some systems or large sampling periods.

For a linear system with constant input over each sampling interval, the exact discrete model is

xk+1 = Adxk + Bduk

where

Ad = eATs, Bd = ∫₀Ts eAτB dτ

The matrix exponential is exact for the stated zero-order-hold assumption. In practice, software computes these quantities using reliable numerical algorithms.

Sampling must be fast enough to represent relevant system dynamics. Sampling too slowly can cause aliasing and degraded control performance. Anti-alias filtering and an explicit sampling policy are important in physical implementations.

9. Computational Foundations and Reproducibility

MATLAB and Python provide numerical linear algebra, plotting, symbolic manipulation, differential-equation solvers, and optimization tools. A reproducible computational workflow should:

  • record software and package versions;
  • define parameters in one clearly identified location;
  • use SI units consistently or document conversions;
  • separate model definition, simulation, visualization, and analysis;
  • set random seeds when randomness is used;
  • preserve source code and input data;
  • report tolerances, solver methods, and sampling intervals;
  • compare numerical results with analytical or limiting cases.

A minimal Python example for Euler simulation is:

import numpy as np
import matplotlib.pyplot as plt

m, c, k = 1.0, 0.4, 4.0
Ts, tf = 0.001, 5.0
t = np.arange(0, tf + Ts, Ts)
x = np.zeros((len(t), 2))       # [position, velocity]

for n in range(len(t) - 1):
    force = 1.0 if t[n] >= 0.1 else 0.0
    position, velocity = x[n]
    acceleration = (force - c*velocity - k*position) / m
    x[n+1] = x[n] + Ts*np.array([velocity, acceleration])

plt.plot(t, x[:, 0])
plt.xlabel('Time (s)')
plt.ylabel('Position (m)')
plt.grid(True)
plt.show()

The code is an implementation of the stated model, not evidence that the model is physically correct. Verification asks whether the code solves the equations as intended; validation asks whether those equations represent the real system adequately.

10. Illustrative Case: Modeling a Self-Balancing Two-Wheel Robot

Background

A two-wheel robot must maintain an approximately upright body while motors adjust wheel torque. This is a coupled mechatronic system involving mechanical dynamics, motor electrical dynamics, sensors, and digital control.

Problem

An engineer needs a model suitable for initial controller design. A detailed flexible-body model would be unnecessarily expensive at this stage, while a purely static model cannot represent instability or corrective motion.

Analysis and approach

Near the upright position, let θ be the small body tilt angle, ω wheel-related velocity, and i motor current. The engineer first constructs rigid-body force and torque balances, then adds motor equations similar to the DC motor model. Around the upright equilibrium, nonlinear trigonometric terms are linearized using sin θ ≈ θ. The resulting state vector may be

x = [ θ dθ/dt s ds/dt i ]ᵀ

where s is wheel displacement. The equations are assembled into dx/dt = Ax + Bu. Eigenvalues of A reveal the open-loop instability and dominant modes. The model is discretized using the measured controller sampling period, and a state-feedback controller is tested in simulation.

The team then performs sensitivity analysis by varying mass, centre-of-mass height, friction, battery voltage, and sensor delay. Experimental data from a stationary tilt test and a low-speed motion test are used to estimate parameters. Model predictions are compared with measured angle and motor current.

Outcome

The simplified model successfully predicts the direction and approximate time scale of the unstable tilt mode, allowing safe initial controller tuning. It does not accurately predict high-speed tire slip or structural vibration. Those effects are excluded from the first model but added later when experiments show their importance.

Learning points

  1. The model purpose determines the required level of detail.
  2. Linearization is useful near an operating point but cannot describe all operating conditions.
  3. Eigenvalues provide insight into dynamic modes and stability.
  4. Simulation must be followed by experimental validation.
  5. Unmodeled delays, saturation, friction, and sensor noise may dominate practical behavior.

11. Limitations, Professional Practice, and Emerging Tools

Every model contains assumptions. Linear models may fail under saturation, backlash, friction transitions, large deformation, magnetic saturation, or wide operating ranges. Numerical solvers may fail because of stiffness, poor scaling, discontinuities, or inappropriate tolerances.

Engineers should state assumptions visibly, preserve dimensional information, and avoid presenting simulation plots as measured facts. Safety-critical models require traceability, independent checking, version control, and documented validation. Data-driven and AI-assisted models can identify patterns or approximate difficult dynamics, but they do not remove the need for physical reasoning. Their predictions may be unreliable outside the training distribution, and their use should include uncertainty assessment, bias checks, data governance, and human engineering oversight.

Contemporary workflows increasingly combine symbolic derivation, automatic differentiation, optimization, digital twins, hardware-in-the-loop testing, and real-time simulation. These tools are valuable only when the underlying model, data, and assumptions are controlled.

Best Practices Checklist

Before accepting a mathematical model, ask:

  • Are the system boundary and purpose clear?
  • Are all variables and parameters defined with units?
  • Are assumptions and neglected effects recorded?
  • Does every additive equation pass a dimensional check?
  • Do limiting cases produce sensible results?
  • Is the numerical method appropriate for the dynamics?
  • Has the model been verified computationally and validated experimentally?
  • Are scaling, conditioning, sampling, and uncertainty addressed?
  • Can another engineer reproduce the result from the documented files?

Chapter Summary

Mathematical modeling transforms physical principles into equations that can be analyzed, simulated, and used for design. Functions and state vectors describe relationships and system condition; matrices organize coupled equations; eigenvalues reveal dynamic modes and stability. Partial derivatives, Jacobians, and Taylor approximations support linearization and sensitivity analysis. Dimensional consistency detects errors and guides nondimensionalization and scaling. Continuous models arise from conservation laws and constitutive relations, while discrete models support digital computation and control. Reliable computational practice requires documented assumptions, suitable numerical methods, unit discipline, verification, validation, and reproducibility. In mechatronics, the most useful model is not necessarily the most detailed one, but the one whose accuracy and limitations are appropriate to the engineering decision.

Key Terms

Mathematical model: A purposeful mathematical representation of a physical or engineered system.

State: A variable or set of variables that captures the system condition needed to predict future behavior.

State-space model: A first-order vector description using state, input, and output equations.

Parameter: A quantity treated as fixed for a particular model or operating condition.

Matrix: A rectangular array used to represent linear relationships and data.

Determinant: A scalar associated with a square matrix that helps identify singularity.

Eigenvalue: A scalar satisfying Av = λv for a nonzero eigenvector.

Eigenvector: A nonzero vector whose direction is preserved by a matrix transformation.

Gradient: A vector of first partial derivatives of a scalar function.

Jacobian: A matrix of first partial derivatives of a vector-valued function.

Hessian: A matrix of second partial derivatives of a scalar function.

Linearization: Local approximation of a nonlinear model by a linear model.

Dimensional consistency: The requirement that terms added or equated have compatible physical dimensions.

Nondimensionalization: Rescaling variables to form dimensionless equations or groups.

Discretization: Conversion of a continuous model into equations evaluated at discrete times.

Sampling period: The time interval between successive digital measurements or updates.

Verification: Checking whether an implementation correctly solves the intended equations.

Validation: Checking whether a model adequately represents the real system for its intended use.

Sensitivity analysis: Study of how outputs change when parameters or inputs vary.

Reproducibility: The ability to regenerate an analysis from documented code, data, parameters, and procedures.

Review Questions

Short Answer Questions

  1. What distinguishes a state variable from an ordinary measured output?
  2. State the continuous-time linear state-space model and define its matrices.
  3. Why must terms in an additive physical equation have matching dimensions?
  4. What is the engineering significance of an eigenvalue’s real part in a continuous-time linear system?
  5. Distinguish verification from validation.

Long Answer Questions

  1. Explain a systematic procedure for deriving a mechatronic model from physical laws, including assumptions and validation.
  2. Discuss the role of matrices, Jacobians, and eigenvalues in modeling coupled mechatronic systems.
  3. Derive and explain the linearized small-angle model of a pendulum, including the approximation’s limitations.
  4. Compare Euler discretization with exact zero-order-hold discretization for a linear system.
  5. Explain how dimensional analysis, scaling, and nondimensionalization improve engineering computation.

Analytical / Application Questions

  1. For a mass–spring–damper system with m = 2 kg, c = 1 N·s/m, and k = 8 N/m, formulate a first-order state-space model using position and velocity as states. Identify the units of every state-equation coefficient.
  2. A discrete-time model has eigenvalues 0.8, −0.4, and 1.02. Determine whether the model is asymptotically stable and justify the conclusion.
  3. Design a reproducible computational experiment to determine whether a linearized robot model remains accurate over a specified range of tilt angles. State the simulations, comparison metrics, parameter variations, and validation evidence required.

Multiple Choice Questions with Answers

Question 1

Which equation represents a continuous-time linear time-invariant state-space model?

A. dx/dt = Ax + Bu, y = Cx + Du

B. xk+1 = xk + Ts²uk

C. y = mx + b

D. Av = λv

Correct Answer: A. dx/dt = Ax + Bu, y = Cx + Du

Question 2

For a continuous-time linear system, which eigenvalue condition is required for asymptotic stability?

A. All eigenvalues have positive real parts.

B. All eigenvalues have zero real parts.

C. All eigenvalues have strictly negative real parts.

D. All eigenvalues have magnitude greater than one.

Correct Answer: C. All eigenvalues have strictly negative real parts.

Question 3

What is the main purpose of a Jacobian matrix in local nonlinear-system analysis?

A. It stores physical units.

B. It gives first-order sensitivities of vector outputs to vector inputs.

C. It calculates only determinants.

D. It replaces all experimental validation.

Correct Answer: B. It gives first-order sensitivities of vector outputs to vector inputs.

Question 4

Which approximation is valid for sufficiently small θ measured in radians?

A. sin θ ≈ 1/θ

B. sin θ ≈ θ

C. sin θ ≈ θ²

D. sin θ ≈ e^θ

Correct Answer: B. sin θ ≈ θ

Question 5

In the equation m d²x/dt² + c dx/dt + kx = F, what are the units of k?

A. N/m

B. N·m

C. kg/s

D. m/N

Correct Answer: A. N/m

Question 6

For xk+1 = Adxk, which eigenvalue condition indicates asymptotic stability?

A. Every eigenvalue has magnitude less than one.

B. Every eigenvalue has a positive real part.

C. Every eigenvalue equals one.

D. Every eigenvalue has magnitude greater than one.

Correct Answer: A. Every eigenvalue has magnitude less than one.

Question 7

Why is directly computing A⁻¹ usually discouraged when solving Ax = b numerically?

A. An inverse changes the units of every variable.

B. Direct solution is generally more efficient and numerically stable.

C. A square matrix cannot have an inverse.

D. The right-hand side must always be zero.

Correct Answer: B. Direct solution is generally more efficient and numerically stable.

Question 8

What does validation assess?

A. Whether code follows the programming language syntax.

B. Whether a model adequately represents the real system for its intended purpose.

C. Whether a matrix is square.

D. Whether a variable is dimensionless.

Correct Answer: B. Whether a model adequately represents the real system for its intended purpose.

Question 9

Using forward Euler for dx/dt = f(x,u,t) gives which update?

A. xk+1 = xk + Ts f(xk,uk,tk)

B. xk+1 = xk/Ts

C. xk+1 = f(xk+1,uk+1,tk+1)

D. xk+1 = xk − Ts²f(xk,uk,tk)

Correct Answer: A. xk+1 = xk + Ts f(xk,uk,tk)

Question 10

Which practice most directly supports computational reproducibility?

A. Changing parameters manually without recording them.

B. Reporting only the final graph.

C. Preserving code, data, parameters, software versions, and solver settings.

D. Using the most complicated model available.

Correct Answer: C. Preserving code, data, parameters, software versions, and solver settings.

Engineering Mathematics III
Chapter 1 of 15