【发布时间】:2022-01-22 20:12:36
【问题描述】:
【问题讨论】:
-
从尝试获取左半部分开始。其余的只是镜像的相同曲线,在时间上移动并垂直偏移以匹配前半部分的最后一个 y 值。
标签: python numpy matplotlib math plot
【问题讨论】:
标签: python numpy matplotlib math plot
首先,你必须定义一个带有时间值的t数组:
t = np.linspace(0, 0.01, N)
然后您可以计算 Vr 作为时间的函数。您报告的表达式包含一个 ±,因此它不是数学函数:您必须为每个符号定义两个不同的函数(数组):
Vr_plus = 15000*np.exp(-2500*t)*np.sin(t)
Vr_minus = -15000*np.exp(-2500*t)*np.sin(t)
最后,你可以画出情节了:
plt.style.use('seaborn-whitegrid')
fig, ax = plt.subplots()
ax.plot(t, Vr_plus)
ax.plot(t, Vr_minus)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
N = 1000
t = np.linspace(0, 0.01, N)
Vr_plus = 15000*np.exp(-2500*t)*np.sin(t)
Vr_minus = -15000*np.exp(-2500*t)*np.sin(t)
plt.style.use('seaborn-whitegrid')
fig, ax = plt.subplots()
ax.plot(t, Vr_plus)
ax.plot(t, Vr_minus)
plt.show()
【讨论】: