Chapter 5: Electrical, Fluid, and Thermal System Modeling

Lesson 2: Mechanical–Electrical Analogies (Force–Voltage, Force–Current, etc.)

This lesson develops rigorous mechanical–electrical analogies as structure-preserving mappings between lumped mechanical models (translational/rotational) and electrical circuits. We formalize effort/flow variables, prove power-conjugacy preservation, derive element correspondences for both the impedance (Force–Voltage) and mobility (Force–Current) analogies, and show how interconnection topology changes (series/parallel reversal). Implementations in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica validate the equivalence by simulation.

1. Why Mechanical–Electrical Analogies Matter

In Chapter 3–4, you derived mechanical ODEs (e.g., mass–spring–damper). In Chapter 5 Lesson 1, you derived electrical ODEs for RLC networks. Mechanical–electrical analogies let us:

  • Reuse circuit intuition and analysis tools for mechanical networks.
  • Construct multi-domain models in a systematic way (mechanical + electrical subsystems).
  • Check correctness by verifying that the mapped model preserves power and yields the same dynamics.
flowchart TD
  A["Start from lumped mechanical model (ports, elements, interconnections)"] --> B["Choose analogy: Force-Voltage or Force-Current"]
  B --> C["Map effort/flow variables and element laws"]
  C --> D["Build equivalent circuit (same port behavior)"]
  D --> E["Derive ODEs for both models"]
  E --> F["Prove equivalence (same differential equation / same port relation)"]
  F --> G["Simulate and compare trajectories"]
        

2. Effort/Flow Variables and Power-Conjugate Pairs

A key idea in system dynamics is that many physical domains can be described using \( \text{effort} \) and \( \text{flow} \) variables, whose product is power.

Translational mechanical:

  • \( e_m(t) = F(t) \): force (effort)
  • \( f_m(t) = v(t) \): velocity (flow)
  • \( p(t) = F(t)\,v(t) \): power

Rotational mechanical:

  • \( e_r(t) = \tau(t) \): torque (effort)   (write as \( \tau(t) \) only when using the LaTeX command)
  • \( f_r(t) = \omega(t) \): angular velocity (flow)
  • \( p(t) = \tau(t)\,\omega(t) \): power

Electrical:

  • \( e_e(t) = V(t) \): voltage (effort)
  • \( f_e(t) = I(t) \): current (flow)
  • \( p(t) = V(t)\,I(t) \): power

An analogy is meaningful when it preserves power at corresponding ports. This is the mathematical reason both common analogies exist.

Power-preserving requirement (port-wise):

\[ p_m(t) = e_m(t)\,f_m(t) \;=\; p_e(t) = e_e(t)\,f_e(t). \]

Two simple bijections satisfy this identity:

  • Impedance analogy (Force–Voltage): \( F \leftrightarrow V \) and \( v \leftrightarrow I \).
  • Mobility analogy (Force–Current): \( F \leftrightarrow I \) and \( v \leftrightarrow V \).

Proof of power preservation (both analogies):

If \( F \leftrightarrow V \) and \( v \leftrightarrow I \), then \( Fv \leftrightarrow VI \) identically. If \( F \leftrightarrow I \) and \( v \leftrightarrow V \), then again \( Fv \leftrightarrow IV = VI \). Hence both are power-conjugate mappings.

3. Force–Voltage (Impedance) Analogy

In the impedance analogy we map \( F \leftrightarrow V \) and \( v \leftrightarrow I \). To derive element correspondences, we match constitutive laws at a 1-port (element port).

Mechanical element laws (translational):

  • Mass \(m\): \( F(t) = m\,\dfrac{dv(t)}{dt} \)
  • Damper \(b\): \( F(t) = b\,v(t) \)
  • Spring \(k\): \( F(t) = k\,x(t) \) and \( v(t)=\dfrac{dx(t)}{dt} \)

Electrical element laws (from Chapter 5 Lesson 1):

  • Inductor \(L\): \( V(t) = L\,\dfrac{dI(t)}{dt} \)
  • Resistor \(R\): \( V(t) = R\,I(t) \)
  • Capacitor \(C\): \( I(t) = C\,\dfrac{dV(t)}{dt} \) (equivalently \( V(t)=\dfrac{1}{C}\int I(t)\,dt \))

Element mapping by equation matching:

Using \( F \leftrightarrow V \) and \( v \leftrightarrow I \):

(i) Mass \(m\) \(\leftrightarrow\) Inductor \(L\)

\[ F(t) = m\,\frac{dv(t)}{dt} \quad \leftrightarrow \quad V(t) = L\,\frac{dI(t)}{dt} \;\;\Rightarrow\;\; L = m. \]

(ii) Damper \(b\) \(\leftrightarrow\) Resistor \(R\)

\[ F(t) = b\,v(t) \quad \leftrightarrow \quad V(t) = R\,I(t) \;\;\Rightarrow\;\; R = b. \]

(iii) Spring \(k\) \(\leftrightarrow\) Capacitor \(C\)

Since \( x(t) = \int v(t)\,dt \), we write:

\[ F(t) = k\,x(t) = k\int v(t)\,dt \quad \leftrightarrow \quad V(t) = \frac{1}{C}\int I(t)\,dt \;\;\Rightarrow\;\; \frac{1}{C} = k \;\;\Rightarrow\;\; C = \frac{1}{k}. \]

Port-impedance viewpoint (Laplace domain):

With Laplace transforms (Chapter 2), define mechanical impedance \( Z_m(s) = \dfrac{F(s)}{v(s)} \) and electrical impedance \( Z_e(s) = \dfrac{V(s)}{I(s)} \). Under the impedance analogy, we enforce \( Z_m(s) = Z_e(s) \).

\[ \begin{aligned} &\text{Mass:}\quad Z_m(s)=\frac{m s\,v(s)}{v(s)} = m s \;\;\leftrightarrow\;\; Z_L(s)=L s \\ &\text{Damper:}\quad Z_m(s)=b \;\;\leftrightarrow\;\; Z_R(s)=R \\ &\text{Spring:}\quad F(s)=k x(s),\; v(s)=s x(s)\;\Rightarrow\; Z_m(s)=\frac{F(s)}{v(s)}=\frac{k}{s} \;\;\leftrightarrow\;\; Z_C(s)=\frac{1}{Cs}. \end{aligned} \]

4. Force–Current (Mobility) Analogy

In the mobility analogy we map \( F \leftrightarrow I \) and \( v \leftrightarrow V \). It is often convenient because mechanical parallel connections map to electrical parallel connections (Section 5).

Element mapping by equation matching:

(i) Mass \(m\) \(\leftrightarrow\) Capacitor \(C\)

\[ F(t) = m\,\frac{dv(t)}{dt} \quad \leftrightarrow \quad I(t) = C\,\frac{dV(t)}{dt} \;\;\Rightarrow\;\; C = m. \]

(ii) Damper \(b\) \(\leftrightarrow\) Resistor \(R\) (via conductance)

If \( F \leftrightarrow I \) and \( v \leftrightarrow V \), then \( F=bv \) becomes \( I=bV \). In circuits, \( I=\dfrac{1}{R}V \), so:

\[ I(t)=b\,V(t) \;\;\Rightarrow\;\; \frac{1}{R} = b \;\;\Rightarrow\;\; R = \frac{1}{b}. \]

(iii) Spring \(k\) \(\leftrightarrow\) Inductor \(L\)

Again \( x(t)=\int v(t)\,dt \), hence \( F(t) = k \int v(t)\,dt \) maps to \( I(t)=k \int V(t)\,dt \). But an inductor satisfies \( V(t)=L\,\dfrac{dI(t)}{dt} \Rightarrow I(t)=\dfrac{1}{L}\int V(t)\,dt \).

\[ I(t)=k\int V(t)\,dt \;\;\leftrightarrow\;\; I(t)=\frac{1}{L}\int V(t)\,dt \;\;\Rightarrow\;\; \frac{1}{L}=k \;\;\Rightarrow\;\; L=\frac{1}{k}. \]

Mobility viewpoint (Laplace domain):

Define mechanical mobility \( Y_m(s)=\dfrac{v(s)}{F(s)} \) and electrical admittance \( Y_e(s)=\dfrac{I(s)}{V(s)} \). Under the mobility analogy, we enforce \( Y_m(s)=Y_e(s) \).

\[ \begin{aligned} &\text{Mass:}\quad Y_m(s)=\frac{v(s)}{m s\,v(s)} = \frac{1}{m s}\;\;\leftrightarrow\;\; Y_C(s)=C s \quad \text{(via } C=m\text{ in time domain)} \\ &\text{Damper:}\quad Y_m(s)=\frac{1}{b}\;\;\leftrightarrow\;\; Y_R(s)=\frac{1}{R} \\ &\text{Spring:}\quad Y_m(s)=\frac{s}{k}\;\;\leftrightarrow\;\; Y_L(s)=\frac{1}{L s}. \end{aligned} \]

The time-domain mappings above are the most reliable way to avoid sign/normalization confusion.

5. Interconnection Topology: Series/Parallel Reversal and Why It Happens

For lumped models, interconnections impose constraints among efforts and flows. Two canonical constraints are:

  • Common flow junction: flows are equal, efforts sum to zero (force balance).
  • Common effort junction: efforts are equal, flows sum to zero (continuity).

Mechanical example (node with rigid connection):

A mass node connected to a spring and damper to ground enforces the same velocity across both elements: \( v_s(t)=v_b(t)=v(t) \), while forces add: \( F_s(t)+F_b(t)+F_{\text{ext}}(t)=m\,\dfrac{dv(t)}{dt} \).

Impedance analogy consequence:

If \( v \leftrightarrow I \) and the mechanical connection imposes a common velocity, then it becomes a common current constraint in the circuit, i.e., a series connection. Thus, mechanically parallel elements (same velocity) often map to electrically series elements under Force–Voltage.

Mobility analogy consequence:

If \( v \leftrightarrow V \), a common velocity becomes a common voltage, i.e., an electrical parallel connection. Thus mechanically parallel elements map to electrically parallel elements under Force–Current.

Short proof (using constraint structure):

Consider two 1-port elements A and B connected in mechanical parallel between a node and ground. Then \( v_A=v_B=v \) and \( F = F_A+F_B \).

  • Impedance analogy: \( v \leftrightarrow I \) implies \( I_A=I_B=I \) (series), and \( F=F_A+F_B \leftrightarrow V=V_A+V_B \) (series voltage additivity).
  • Mobility analogy: \( v \leftrightarrow V \) implies \( V_A=V_B=V \) (parallel), and \( F=F_A+F_B \leftrightarrow I=I_A+I_B \) (parallel current additivity).
flowchart LR
  M["Mechanical port variables: \neffort=F, flow=v"] --> CH["Choose mapping"]
  CH --> FV["Force-Voltage: \nF<->V, v<->I"]
  CH --> FI["Force-Current: \nF<->I, v<->V"]
  FV --> MAP1["Elements: m→L, \nb→R, k→1/C"]
  FI --> MAP2["Elements: m→C, \nb→1/R, k→1/L"]
  FV --> TOP1["Topology: mech parallel (same v) → \nelec series (same I)"]
  FI --> TOP2["Topology: mech parallel (same v) → \nelec parallel (same V)"]
        

6. Canonical Example: Mass–Spring–Damper and Its Two Circuit Counterparts

Consider a translational mass–spring–damper driven by an external force input \( u(t) \) and displacement \( x(t) \).

Mechanical dynamics:

\[ m\,\frac{d^2 x(t)}{dt^2} + b\,\frac{dx(t)}{dt} + k\,x(t) = u(t). \]

Define velocity \( v(t)=\dfrac{dx(t)}{dt} \). Then:

\[ m\,\frac{dv(t)}{dt} + b\,v(t) + k\int v(t)\,dt = u(t). \]

6.1 Force–Voltage (Impedance) circuit: series R–L–C driven by a voltage source

Use mapping \( u(t)\leftrightarrow V_s(t) \), \( v(t)\leftrightarrow I(t) \), with \( L=m \), \( R=b \), \( C=\dfrac{1}{k} \). In a series RLC:

\[ V_s(t) = L\,\frac{dI(t)}{dt} + R\,I(t) + \frac{1}{C}\int I(t)\,dt. \]

Substitute \( I(t)=v(t) \) and \( \frac{1}{C}=k \):

\[ u(t) = m\,\frac{dv(t)}{dt} + b\,v(t) + k\int v(t)\,dt, \]

which is exactly the mechanical equation written in terms of \( v(t) \). Also, the capacitor charge satisfies \( q(t)=\int I(t)\,dt \leftrightarrow \int v(t)\,dt = x(t) \). Hence: \( x(t) \leftrightarrow q(t) \).

6.2 Force–Current (Mobility) circuit: parallel R–L–C driven by a current source

Use mapping \( u(t)\leftrightarrow I_s(t) \), \( v(t)\leftrightarrow V(t) \), with \( C=m \), \( R=\dfrac{1}{b} \), \( L=\dfrac{1}{k} \). For a parallel RLC, KCL gives:

\[ I_s(t) = C\,\frac{dV(t)}{dt} + \frac{1}{R}\,V(t) + \frac{1}{L}\int V(t)\,dt. \]

Substitute \( V(t)=v(t) \), \( C=m \), \( \frac{1}{R}=b \), and \( \frac{1}{L}=k \):

\[ u(t) = m\,\frac{dv(t)}{dt} + b\,v(t) + k\int v(t)\,dt, \]

again matching the mechanical dynamics exactly.

Energy correspondence (optional but rigorous check):

Mechanical stored energy: spring \( E_s = \tfrac{1}{2}k x^2 \), mass \( E_m = \tfrac{1}{2}m v^2 \). In impedance analogy, these map to capacitor and inductor energies:

\[ E_C = \frac{1}{2C}q^2 \quad \text{with } q\leftrightarrow x,\; \frac{1}{C}=k \;\;\Rightarrow\;\; E_C \leftrightarrow \frac{1}{2}k x^2, \]

\[ E_L = \frac{1}{2}L I^2 \quad \text{with } I\leftrightarrow v,\; L=m \;\;\Rightarrow\;\; E_L \leftrightarrow \frac{1}{2}m v^2. \]

Dissipation correspondence: damper power \( p=bv^2 \) maps to resistor power \( p=RI^2 \) with \( R=b \).

7. Rotational Systems and Gear/Lever Couplings as Transformer Relations

Rotational dynamics uses torque \( \tau(t) \) and angular velocity \( \omega(t) \), with power \( p(t)=\tau(t)\omega(t) \). A rigid gear pair with ratio \( g \) (output torque amplification) ideally satisfies:

\[ \omega_2(t) = \frac{1}{g}\,\omega_1(t), \qquad \tau_2(t) = g\,\tau_1(t), \qquad \tau_1(t)\,\omega_1(t) = \tau_2(t)\,\omega_2(t). \]

Proof of power preservation:

\[ \tau_2\,\omega_2 = (g\,\tau_1)\left(\frac{1}{g}\omega_1\right) = \tau_1\,\omega_1. \]

This is mathematically identical to an ideal transformer in circuits, where a ratio enforces a dual scaling on effort and flow while preserving power. Under Force–Voltage, torque behaves like voltage and angular velocity like current; under Force–Current, torque behaves like current and angular velocity like voltage. In both cases, the coupling is transformer-like: scale one variable by \( g \) and the conjugate by \( 1/g \).

8. Computational Validation Across Languages

We validate equivalence using the mass–spring–damper example. We simulate: (i) the mechanical ODE in \( x \), and (ii) the impedance-analog series RLC in \( q \), verifying \( x(t)\approx q(t) \) and \( \dot{x}(t)\approx i(t) \).

8.1 Python (SciPy) — Mechanical vs. Series RLC (Impedance Analogy)

Recommended libraries for this course path: numpy, scipy, sympy. (The control library will become more relevant starting Chapter 6 when transfer functions are introduced.)


import numpy as np
from math import sin
from scipy.integrate import solve_ivp

# Parameters
m = 1.0
b = 0.6
k = 4.0

# Impedance analogy: L=m, R=b, C=1/k
L = m
R = b
C = 1.0 / k

def u(t):
    # Example input force / voltage source
    return 1.0 * np.sin(2.0 * t)

# Mechanical: state [x, v] with v = dx/dt
def mech_rhs(t, z):
    x, v = z
    dx = v
    dv = (u(t) - b*v - k*x) / m
    return [dx, dv]

# Series RLC (impedance analogy):
# Choose states [q, i] where q = capacitor charge, i = dq/dt
# Vs = L di/dt + R i + (1/C) q  => di/dt = (Vs - R i - (1/C) q)/L
def rlc_rhs(t, z):
    q, i = z
    dq = i
    di = (u(t) - R*i - (1.0/C)*q) / L
    return [dq, di]

t0, tf = 0.0, 10.0
z0_mech = [0.0, 0.0]  # x(0)=0, v(0)=0
z0_rlc  = [0.0, 0.0]  # q(0)=0, i(0)=0

sol_mech = solve_ivp(mech_rhs, [t0, tf], z0_mech, max_step=1e-2, rtol=1e-9, atol=1e-12)
sol_rlc  = solve_ivp(rlc_rhs,  [t0, tf], z0_rlc,  max_step=1e-2, rtol=1e-9, atol=1e-12)

t = sol_mech.t
x = sol_mech.y[0]
v = sol_mech.y[1]

q = np.interp(t, sol_rlc.t, sol_rlc.y[0])
i = np.interp(t, sol_rlc.t, sol_rlc.y[1])

# Numerical equivalence checks
err_xq = np.max(np.abs(x - q))
err_vi = np.max(np.abs(v - i))

print("max |x - q| =", err_xq)
print("max |v - i| =", err_vi)
      

8.2 C++ — From-Scratch RK4 (Mechanical vs. Series RLC)

Suggested libraries: Eigen (linear algebra), Boost.Odeint (ODE integration). Below is a minimal from-scratch RK4 to keep dependencies optional.


#include <iostream>
#include <cmath>
#include <array>

static double u(double t) {
    return std::sin(2.0 * t);
}

static std::array<double,2> mech_rhs(double t, const std::array<double,2>& z,
                                      double m, double b, double k) {
    double x = z[0];
    double v = z[1];
    double dx = v;
    double dv = (u(t) - b*v - k*x) / m;
    return {dx, dv};
}

static std::array<double,2> rlc_rhs(double t, const std::array<double,2>& z,
                                     double L, double R, double C) {
    double q = z[0];
    double i = z[1];
    double dq = i;
    double di = (u(t) - R*i - (1.0/C)*q) / L;
    return {dq, di};
}

static std::array<double,2> rk4_step(double t, double h, const std::array<double,2>& z,
                                     std::array<double,2> (*f)(double,const std::array<double,2>&,
                                                             double,double,double),
                                     double a, double b, double c) {
    auto k1 = f(t, z, a, b, c);
    std::array<double,2> z2{ z[0] + 0.5*h*k1[0], z[1] + 0.5*h*k1[1] };

    auto k2 = f(t + 0.5*h, z2, a, b, c);
    std::array<double,2> z3{ z[0] + 0.5*h*k2[0], z[1] + 0.5*h*k2[1] };

    auto k3 = f(t + 0.5*h, z3, a, b, c);
    std::array<double,2> z4{ z[0] + h*k3[0], z[1] + h*k3[1] };

    auto k4 = f(t + h, z4, a, b, c);

    return {
        z[0] + (h/6.0)*(k1[0] + 2.0*k2[0] + 2.0*k3[0] + k4[0]),
        z[1] + (h/6.0)*(k1[1] + 2.0*k2[1] + 2.0*k3[1] + k4[1])
    };
}

int main() {
    const double m = 1.0, b = 0.6, k = 4.0;
    const double L = m, R = b, C = 1.0/k;

    double t0 = 0.0, tf = 10.0, h = 1e-3;

    std::array<double,2> z_mech{0.0, 0.0}; // [x, v]
    std::array<double,2> z_rlc {0.0, 0.0}; // [q, i]

    double max_xq = 0.0;
    double max_vi = 0.0;

    for (double t = t0; t <= tf; t += h) {
        // record errors
        double x = z_mech[0];
        double v = z_mech[1];
        double q = z_rlc[0];
        double i = z_rlc[1];

        max_xq = std::max(max_xq, std::abs(x - q));
        max_vi = std::max(max_vi, std::abs(v - i));

        // advance
        z_mech = rk4_step(t, h, z_mech, mech_rhs, m, b, k);
        z_rlc  = rk4_step(t, h, z_rlc,  rlc_rhs,  L, R, C);
    }

    std::cout << "max |x - q| = " << max_xq << "\\n";
    std::cout << "max |v - i| = " << max_vi << "\\n";
    return 0;
}
      

8.3 Java — From-Scratch RK4 (Mechanical vs. Series RLC)

Suggested libraries: Apache Commons Math (ODE), EJML (linear algebra). Below is a minimal RK4 to keep it standalone.


public class MechElecAnalogyRK4 {

    static double u(double t) {
        return Math.sin(2.0 * t);
    }

    // returns [dx, dv]
    static double[] mechRhs(double t, double[] z, double m, double b, double k) {
        double x = z[0];
        double v = z[1];
        double dx = v;
        double dv = (u(t) - b*v - k*x) / m;
        return new double[]{dx, dv};
    }

    // returns [dq, di]
    static double[] rlcRhs(double t, double[] z, double L, double R, double C) {
        double q = z[0];
        double i = z[1];
        double dq = i;
        double di = (u(t) - R*i - (1.0/C)*q) / L;
        return new double[]{dq, di};
    }

    static double[] rk4Step(double t, double h, double[] z, RHS f,
                            double a, double b, double c) {
        double[] k1 = f.eval(t, z, a, b, c);
        double[] z2 = new double[]{ z[0] + 0.5*h*k1[0], z[1] + 0.5*h*k1[1] };

        double[] k2 = f.eval(t + 0.5*h, z2, a, b, c);
        double[] z3 = new double[]{ z[0] + 0.5*h*k2[0], z[1] + 0.5*h*k2[1] };

        double[] k3 = f.eval(t + 0.5*h, z3, a, b, c);
        double[] z4 = new double[]{ z[0] + h*k3[0], z[1] + h*k3[1] };

        double[] k4 = f.eval(t + h, z4, a, b, c);

        return new double[]{
            z[0] + (h/6.0)*(k1[0] + 2.0*k2[0] + 2.0*k3[0] + k4[0]),
            z[1] + (h/6.0)*(k1[1] + 2.0*k2[1] + 2.0*k3[1] + k4[1])
        };
    }

    interface RHS {
        double[] eval(double t, double[] z, double a, double b, double c);
    }

    public static void main(String[] args) {
        double m = 1.0, b = 0.6, k = 4.0;
        double L = m, R = b, C = 1.0/k;

        double t0 = 0.0, tf = 10.0, h = 1e-3;

        double[] zMech = new double[]{0.0, 0.0}; // [x, v]
        double[] zRlc  = new double[]{0.0, 0.0}; // [q, i]

        double maxXQ = 0.0;
        double maxVI = 0.0;

        RHS mech = (t, z, a, bb, c) -> mechRhs(t, z, a, bb, c);
        RHS rlc  = (t, z, a, bb, c) -> rlcRhs(t, z, a, bb, c);

        for (double t = t0; t <= tf; t += h) {
            double x = zMech[0], v = zMech[1];
            double q = zRlc[0],  i = zRlc[1];

            maxXQ = Math.max(maxXQ, Math.abs(x - q));
            maxVI = Math.max(maxVI, Math.abs(v - i));

            zMech = rk4Step(t, h, zMech, mech, m, b, k);
            zRlc  = rk4Step(t, h, zRlc,  rlc,  L, R, C);
        }

        System.out.println("max |x - q| = " + maxXQ);
        System.out.println("max |v - i| = " + maxVI);
    }
}
      

8.4 MATLAB — ODE45 and a Direct Series RLC Comparison

MATLAB toolchain: ode45 for ODEs, Simulink for block-level modeling, Simscape for multi-domain physical modeling. (Simscape is especially relevant in Chapter 5 Lesson 5 on coupled multi-domain examples.)


% Parameters
m = 1.0; b = 0.6; k = 4.0;

% Impedance analogy
L = m; R = b; C = 1/k;

u = @(t) sin(2*t);

% Mechanical: [x; v]
mech_rhs = @(t,z) [ z(2);
                   (u(t) - b*z(2) - k*z(1))/m ];

% Series RLC: [q; i]
rlc_rhs  = @(t,z) [ z(2);
                   (u(t) - R*z(2) - (1/C)*z(1))/L ];

tspan = [0 10];
z0_mech = [0;0];
z0_rlc  = [0;0];

[tM, zM] = ode45(mech_rhs, tspan, z0_mech);
[tE, zE] = ode45(rlc_rhs,  tspan, z0_rlc);

% Interpolate to compare on same grid
q = interp1(tE, zE(:,1), tM);
i = interp1(tE, zE(:,2), tM);

x = zM(:,1);
v = zM(:,2);

fprintf('max |x - q| = %.3e\\n', max(abs(x - q)));
fprintf('max |v - i| = %.3e\\n', max(abs(v - i)));

% Optional: plot comparisons
figure; plot(tM, x, tM, q, '--'); grid on; legend('x(t)','q(t)');
figure; plot(tM, v, tM, i, '--'); grid on; legend('v(t)','i(t)');
      

Simulink note (text-only): To reproduce the Force–Voltage analogy in Simulink, build a series chain: Voltage source \(V_s(t)\) feeding inductor \(L=m\), resistor \(R=b\), and capacitor \(C=1/k\). Measure capacitor charge (or integrate current) to compare to \(x(t)\).

8.5 Wolfram Mathematica — Symbolic Check and Numerical Simulation


m = 1.0; b = 0.6; k = 4.0;
L = m; R = b; C = 1/k;

u[t_] := Sin[2 t];

(* Mechanical: x'' + (b/m) x' + (k/m) x == u/m *)
mechEq = m x''[t] + b x'[t] + k x[t] == u[t];

(* Series RLC: Vs == L i' + R i + (1/C) q, with q'==i *)
rlcEq1 = u[t] == L i'[t] + R i[t] + (1/C) q[t];
rlcEq2 = q'[t] == i[t];

icMech = {x[0] == 0, x'[0] == 0};
icRlc  = {q[0] == 0, i[0] == 0};

solMech = NDSolve[{mechEq, icMech}, x, {t, 0, 10}][[1]];
solRlc  = NDSolve[{rlcEq1, rlcEq2, icRlc}, {q, i}, {t, 0, 10}][[1]];

errXQ = NMaxValue[Abs[(x[t] /. solMech) - (q[t] /. solRlc)], t \[Element] Interval[{0, 10}]];
errVI = NMaxValue[Abs[(x'[t] /. solMech) - (i[t] /. solRlc)], t \[Element] Interval[{0, 10}]];

{errXQ, errVI}
      

9. Problems and Solutions

The following problems are aligned with standard system dynamics and network analogy exercises in control engineering curricula. Provide complete derivations; numerical evaluation is optional unless requested.

Problem 1 (Element Correspondence Derivation): Starting from the constitutive laws of a mass \(m\), damper \(b\), and spring \(k\), derive the Force–Voltage mappings to \(L\), \(R\), \(C\). Then derive the Force–Current mappings.

Solution:

Force–Voltage: impose \( F \leftrightarrow V \), \( v \leftrightarrow I \). Matching \(F=m\,dv/dt\) to \(V=L\,dI/dt\) gives \(L=m\). Matching \(F=bv\) to \(V=RI\) gives \(R=b\). For the spring, \(F=kx = k\int v dt\) maps to \(V = (1/C)\int I dt\), so \(1/C=k\Rightarrow C=1/k\).

Force–Current: impose \( F \leftrightarrow I \), \( v \leftrightarrow V \). Matching \(F=m\,dv/dt\) to \(I=C\,dV/dt\) gives \(C=m\). Matching \(F=bv\) to \(I=(1/R)V\) gives \(1/R=b\Rightarrow R=1/b\). Matching \(F=k\int v dt\) to \(I=(1/L)\int V dt\) gives \(1/L=k\Rightarrow L=1/k\).

Problem 2 (Series/Parallel Reversal Proof): Two mechanical elements A and B are connected in parallel between a rigid node and ground. Prove that under Force–Voltage the electrical counterparts must be in series, while under Force–Current they remain in parallel.

Solution:

Mechanical parallel implies a common velocity and additive forces: \( v_A=v_B=v \), \( F=F_A+F_B \). Under Force–Voltage, \(v \leftrightarrow I\) implies \(I_A=I_B=I\), which is the defining constraint of a series connection, and \(F \leftrightarrow V\) implies \(V=V_A+V_B\), consistent with series voltage addition. Under Force–Current, \(v \leftrightarrow V\) implies \(V_A=V_B=V\) (parallel constraint), and \(F \leftrightarrow I\) yields \(I=I_A+I_B\), consistent with parallel current addition.

Problem 3 (Construct the Analog Circuit): A mass \(m\) is attached to ground by a spring \(k\) and a damper \(b\) in parallel, and an external force input \(u(t)\) is applied. (a) Write the mechanical ODE in \(x(t)\). (b) Construct the Force–Voltage analog circuit and write its governing equation in current.

Solution:

(a) Force balance yields:

\[ m\,\frac{d^2 x(t)}{dt^2} + b\,\frac{dx(t)}{dt} + k\,x(t) = u(t). \]

(b) Under Force–Voltage: \(L=m\), \(R=b\), \(C=1/k\), and \(u(t)\leftrightarrow V_s(t)\), \(v(t)\leftrightarrow I(t)\). The series RLC equation is:

\[ V_s(t) = L\,\frac{dI(t)}{dt} + R\,I(t) + \frac{1}{C}\int I(t)\,dt. \]

Substituting \(L=m\), \(R=b\), \(1/C=k\) gives the same velocity-form mechanical dynamics, and the charge \( q(t)=\int I(t)\,dt \) corresponds to displacement \( x(t) \).

Problem 4 (Energy Consistency Check): For the Force–Voltage analogy, show that spring energy \( \tfrac{1}{2}k x^2 \) maps to capacitor energy \( \tfrac{1}{2C}q^2 \), and mass kinetic energy \( \tfrac{1}{2}m v^2 \) maps to inductor energy \( \tfrac{1}{2}L I^2 \).

Solution:

Under Force–Voltage, \(x \leftrightarrow q\), \(v \leftrightarrow I\), \(L=m\), \(C=1/k\). Then:

\[ \frac{1}{2C}q^2 = \frac{1}{2(1/k)}x^2 = \frac{1}{2}k x^2, \qquad \frac{1}{2}L I^2 = \frac{1}{2}m v^2. \]

Hence stored energy is preserved under the mapping, consistent with power preservation at the port level.

Problem 5 (Transformer-Like Coupling): A lossless ideal gear has ratio \(g\) such that \( \omega_2 = \omega_1/g \) and \( \tau_2 = g \tau_1 \). Prove that it preserves power and explain how this mirrors an ideal transformer constraint.

Solution:

Power is \(p=\tau\omega\). Using the constraints:

\[ p_2 = \tau_2 \omega_2 = (g\,\tau_1)\left(\frac{1}{g}\omega_1\right) = \tau_1\omega_1 = p_1. \]

Thus the gear scales effort by \(g\) and flow by \(1/g\) while preserving their product, exactly the defining behavior of an ideal transformer.

10. Summary

We formalized mechanical–electrical analogies as power-preserving mappings between effort/flow variables. The Force–Voltage (impedance) analogy yields \( m \leftrightarrow L \), \( b \leftrightarrow R \), \( k \leftrightarrow 1/C \), typically reversing mechanical parallel into electrical series. The Force–Current (mobility) analogy yields \( m \leftrightarrow C \), \( b \leftrightarrow 1/R \), \( k \leftrightarrow 1/L \), typically preserving parallel structure. A canonical mass–spring–damper example demonstrated exact ODE equivalence, and simulations in multiple languages confirmed the mapping.

11. References

  1. Firestone, F.A. (1933). A new analogy between mechanical and electrical systems. Journal of the Acoustical Society of America, 4(4), 249–267.
  2. Butterworth, S. (1929). On the theory of filter amplifiers. Wireless Engineer, 7, 536–541.
  3. Kron, G. (1939). Tensor analysis of networks. Journal of Mathematics and Physics, 18, 210–242.
  4. Mason, S.J. (1953). Feedback theory—Some properties of signal flow graphs. Proceedings of the IRE, 41(9), 1144–1156.
  5. Paynter, H.M. (1961). Analysis and Design of Engineering Systems. (Foundational theoretical development of energy-based network analogies; widely cited in journal literature.)
  6. Trentelman, H.L., Stoorvogel, A.A., & Hautus, M. (2001). Control Theory for Linear Systems. (Theoretical context for port variables and energy consistency; complements journal foundations.)
  7. van der Schaft, A.J. (2000). L2-Gain and Passivity Techniques in Nonlinear Control. (Theoretical energy/passivity framework underpinning power-preserving interconnections.)

Note: Some foundational contributions are books that formalize the theoretical framework used heavily in subsequent journal literature; the Firestone paper is the canonical journal origin for the mobility analogy.