自由度无阻尼系统的非周期自由振动

Figure_1


import numpy as np
import matplotlib.pyplot as plt

# ====================== 1. 系统参数设置 ======================
k = 1.0
m = 1.0
omega1 = np.sqrt(k / m)
omega2 = np.sqrt(3 * k / m)

# 时间轴:横坐标为 ω1*t,范围0~12
tau = np.linspace(0, 12, 2000)
t = tau / omega1

# ====================== 2. 各阶模态位移表达式 ======================
# 第一阶固有振动(同相振型 [1,1])
u1_mode1 = 0.5 * np.cos(omega1 * t)
u2_mode1 = 0.5 * np.cos(omega1 * t)

# 第二阶固有振动(反相振型 [1,-1])
u1_mode2 = 0.5 * np.cos(omega2 * t)
u2_mode2 = -0.5 * np.cos(omega2 * t)

# 系统自由振动(两阶模态叠加)
u1_total = u1_mode1 + u1_mode2
u2_total = u2_mode1 + u2_mode2

# ====================== 3. 绘图设置 ======================
plt.rcParams['font.sans-serif'] = ['SimHei']  # 中文显示
plt.rcParams['axes.unicode_minus'] = False
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))

# 左图:u1 位移曲线
ax1.plot(tau, u1_total, 'k-', linewidth=2, label='自由振动')
ax1.plot(tau, u1_mode1, 'r-', linewidth=1, label='第一阶固有振动')
ax1.plot(tau, u1_mode2, 'b--', linewidth=1.2, label='第二阶固有振动')
ax1.set_xlabel(r'$\omega_1 t$')
ax1.set_ylabel(r'$u_1$')
ax1.set_ylim(-1.0, 1.0)
ax1.set_xlim(0, 12)
ax1.grid(True, alpha=0.3)
ax1.legend()

# 右图:u2 位移曲线
ax2.plot(tau, u2_total, 'k-', linewidth=2, label='自由振动')
ax2.plot(tau, u2_mode1, 'r-', linewidth=1, label='第一阶固有振动')
ax2.plot(tau, u2_mode2, 'b--', linewidth=1.2, label='第二阶固有振动')
ax2.set_xlabel(r'$\omega_1 t$')
ax2.set_ylabel(r'$u_2$')
ax2.set_ylim(-1.0, 1.0)
ax2.set_xlim(0, 12)
ax2.grid(True, alpha=0.3)
ax2.legend()

# 总标题
fig.suptitle('二自由度无阻尼系统的非周期自由振动', fontsize=14)
plt.tight_layout()
plt.show()


posted @ 2026-06-22 09:11  redufa  阅读(5)  评论(0)    收藏  举报