Spaces:
Sleeping
Sleeping
File size: 1,406 Bytes
3d434e7 a600d00 3d434e7 4e5a23c 8b5ba1c 3d434e7 a600d00 3d434e7 a600d00 3d434e7 4e5a23c 8b5ba1c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # utils/plot_utils.py
import matplotlib.pyplot as plt
import numpy as np
def plot_beam_shape(span_lengths, supports, load_type):
fig, ax = plt.subplots(figsize=(10, 2))
ax.plot([0, sum(span_lengths)], [0, 0], color='black', lw=4)
current_position = 0
for i, length in enumerate(span_lengths):
ax.plot([current_position + length, current_position + length], [0, 1], color='blue', lw=2)
current_position += length
for i, support in enumerate(supports):
ax.text(i * 10, 0.5, support, ha='center', fontsize=12)
ax.set_title("Beam Shape")
ax.axis('off')
plt.show()
def plot_sfd(shear_forces, span_lengths):
fig, ax = plt.subplots(figsize=(10, 6))
x = np.linspace(0, sum(span_lengths), len(shear_forces))
y = shear_forces
ax.plot(x, y, label='Shear Force', color='red', lw=2)
ax.set_title("Shear Force Diagram (SFD)")
ax.set_xlabel("Beam Length (ft)")
ax.set_ylabel("Shear Force (kN)")
ax.grid(True)
plt.show()
def plot_bmd(bending_moments, span_lengths):
fig, ax = plt.subplots(figsize=(10, 6))
x = np.linspace(0, sum(span_lengths), len(bending_moments))
y = bending_moments
ax.plot(x, y, label='Bending Moment', color='blue', lw=2)
ax.set_title("Bending Moment Diagram (BMD)")
ax.set_xlabel("Beam Length (ft)")
ax.set_ylabel("Bending Moment (kNm)")
ax.grid(True)
plt.show()
|