Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

5 (exercises). Multiple-Degree-of-Freedom Systems — Eigenproblem & Modal Analysis

ISAE-SUPAERO

🟩 Complete every # TODO. Solution: 05_MDOF_EigenProblem_ModalAnalysis.ipynb.

import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import eigh
from scipy.integrate import solve_ivp

plt.rcParams["figure.figsize"] = (7, 4.2)
plt.rcParams["axes.grid"] = True
np.set_printoptions(precision=4, suppress=True)

Exercise (handwritten) — 3-step approach

🟥 (1) Solve ∣−ω2M+K∣=0⇒ωi|-\omega^2M+K|=0\Rightarrow\omega_i. (2) Solve (−ω2M+K)u=0(-\omega^2M+K)\mathbf u=0 with ω=ωi⇒ui\omega=\omega_i\Rightarrow\mathbf u_i. (3) Physically sort the natural frequencies with their mode shapes.

Exercise “EX4” — solve the eigenproblem

🟩 For m1=5,m2=10,k1=k2=2,k3=4m_1=5,m_2=10,k_1=k_2=2,k_3=4, build MM, KK and complete eigsort using scipy.linalg.eigh(K, M), sorted by ascending frequency.

M = np.array([[5.0, 0.0], [0.0, 10.0]])
K = np.array([[4.0, -2.0], [-2.0, 6.0]])


def eigsort(K, M):
    lam, U = ...  # TODO
    order = ...  # TODO
    lam, U = lam[order], U[:, order]
    wn = ...  # TODO
    return U, wn


U, wn = eigsort(K, M)
print("Natural frequencies (rad/s):", wn)
print("Mode shapes:\n", U)

Exercise “EX4B” — verify orthogonality, compute modal mass/stiffness

🟩 Verify u1TMu2≈0u_1^TMu_2\approx0 and compute modal mass mi=uiTMuim_i=u_i^TMu_i and modal stiffness ki=uiTKuik_i=u_i^TKu_i; check ki=miωi2k_i=m_i\omega_i^2.

u1, u2 = U[:, 0], U[:, 1]

is_it_zero = ...  # TODO
m1_modal, m2_modal = ..., ...  # TODO
k1_modal, k2_modal = ..., ...  # TODO
print(is_it_zero, m1_modal, m2_modal, k1_modal, k2_modal)

Exercise “EX4C” — modal matrix

🟩 Build P=[u1 u2]P=[u_1\ u_2] and verify PTMPP^TMP and PTKPP^TKP are both diagonal.

P = ...  # TODO
print(P.T @ M @ P)
print(P.T @ K @ P)

Exercise “EX4D” — modal response to initial conditions

🟩 For x0=[1,1]Tx_0=[1,1]^T, x˙0=[0,0]T\dot x_0=[0,0]^T: compute q0=PTMx0q_0=P^TMx_0, q˙0=PTMx˙0\dot q_0=P^TM\dot x_0, propagate each uncoupled SHM qi(t)=qi0cos⁡(ωit)+q˙i0ωisin⁡(ωit)q_i(t)=q_{i0}\cos(\omega_it)+\frac{\dot q_{i0}}{\omega_i} \sin(\omega_i t), then recover x(t)=Pq(t)\mathbf x(t)=P\mathbf q(t). Cross-check against a direct numerical integration of the coupled system.

x0 = np.array([1.0, 1.0])
xdot0 = np.array([0.0, 0.0])

q0 = ...  # TODO
qdot0 = ...  # TODO

t = np.arange(0, 100.1, 0.1)
q1 = ...  # TODO
q2 = ...  # TODO
q = np.vstack([q1, q2])
x = P @ q

# TODO: plot x[0], x[1] vs t


def mdof_free_ode(t, y, M, K):
    n = M.shape[0]
    x, v = y[:n], y[n:]
    a = ...  # TODO
    return np.concatenate([v, a])


sol = ...  # TODO: solve_ivp(...)
# TODO: print max abs difference between modal and numerical solutions

Exercise “EX4E” — proportional damping & forced modal response

🟩 For m1=9,m2=1,k1=27,k2=3m_1=9,m_2=1,k_1=27,k_2=3, α=0,β=0.1\alpha=0,\beta=0.1: build C=αM+βKC=\alpha M+\beta K, get the modal quantities, and derive ζi=Cm,i/(2ωi)\zeta_i = C_{m,i}/(2\omega_i) (mass-normalized modes). For f(t)=[0, 3cos⁡(2t)]Tf(t)=[0,\ 3\cos(2t)]^T, build the steady-state modal solution qi(t)=Ni(ωi2−Ω2)2+(2ζiωiΩ)2cos⁡(Ωt−ϕi)q_i(t)=\dfrac{N_i}{\sqrt{(\omega_i^2-\Omega^2)^2+(2\zeta_i\omega_i\Omega)^2}} \cos(\Omega t-\phi_i), ϕi=atan2⁡(2ζiωiΩ,ωi2−Ω2)\phi_i=\operatorname{atan2}(2\zeta_i\omega_i\Omega,\omega_i^2-\Omega^2), with Ni=uiTfampN_i=u_i^Tf_{\text{amp}}, then recover xss=Pqss\mathbf x_{ss}=P\mathbf q_{ss}. Cross-check against direct numerical integration of the full damped, coupled system (they should match once the transient dies out).

M = np.diag([9.0, 1.0])
K = np.array([[27.0, -3.0], [-3.0, 3.0]])
alpha, beta = 0.0, 0.1
C = ...  # TODO

U, wn = eigsort(K, M)
P = U
Mm = ...  # TODO
Cm = ...  # TODO
Km = ...  # TODO
zeta = ...  # TODO
print(zeta)

Omega, F2amp = 2.0, 3.0
f_amp = np.array([0.0, F2amp])
N_amp = ...  # TODO

t = np.linspace(0, 60, 6000)
q_ss = np.zeros((2, len(t)))
for i in range(2):
    denom = ...  # TODO
    Qamp = ...  # TODO
    phi = ...  # TODO
    q_ss[i] = Qamp * np.cos(Omega * t - phi)

x_ss = P @ q_ss


def mdof_forced_ode(t, y, M, C, K, f_amp, Omega):
    n = M.shape[0]
    x, v = y[:n], y[n:]
    f = ...  # TODO
    a = ...  # TODO
    return np.concatenate([v, a])


sol = ...  # TODO

# TODO: plot x_ss[0] vs sol.y[0] and print the max abs difference for t>40