runs = {}
for name, kind, width, t_rel in [("initial condition", "ic", 0, 0), ("pick", "force", 0.0, 5e-5), ("finger", "force", 0.015, 2e-3)]:
s = guitar_string(1)
ex = Pluck(s, s.L - 0.13, F0=1.0, width=width, t_rel=t_rel) if kind == "force" else None
if kind == "ic":
pluck_ic(s, s.L - 0.13)
runs[name] = (simulate([s], dur=2.0, exciters=[ex])["bridge"], ex)
save_wav("pluck_" + name.split()[0], runs[name][0])
fig, axs = plt.subplots(2, 1, figsize=(5.4, 3.6), height_ratios=[1, 1.4])
t = np.linspace(0.0095, 0.0125, 600)
for (name, (y, ex)), col in zip(list(runs.items())[1:], [COL["stiff"], COL["exciter"]]):
axs[0].plot(1e3 * t, [ex.force(ti) for ti in t], color=col, lw=2, label=name)
axs[0].set_xlabel("time (ms)"); axs[0].set_ylabel("$F/F_0$"); axs[0].legend(fontsize=7.5)
axs[0].set_title("the release", fontsize=9)
for (name, (y, ex)), col, mk in zip(runs.items(), ["0.4", COL["stiff"], COL["exciter"]], ["s", "o", "^"]):
axs[1].plot(np.arange(1, 31), partial_amps(y, 110.0, B=5e-5), mk + "-", color=col, ms=3, lw=1, label=name)
axs[1].set_xlabel("partial $p$"); axs[1].set_ylabel("dB"); axs[1].set_ylim(-70, 3)
axs[1].legend(fontsize=7.5, ncol=3, loc="lower left"); axs[1].set_title("partial amplitudes (first 0.5 s)", fontsize=9)
plt.tight_layout()
plt.show()