conda create -n huizhou python=3.8
conda activate huizhou
conda install numpy matplotlib
pip install mplfonts
mplfonts init
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 100)
sin_x = np.sin(x)
cos_x = np.cos(x)
tan_x = np.tan(x)
fig, axes = plt.subplots(3, 1, figsize=(8, 12))
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
axes[0].plot(x, sin_x, label='sin(x)', color='blue')
axes[0].set_title('正弦函数的波形')
axes[0].set_xlabel('角度 (弧度)')
axes[0].set_ylabel('sin(x)')
axes[0].legend()
axes[0].grid(True)
axes[1].plot(x, cos_x, label='cos(x)', color='green')
axes[1].set_title('余弦函数的波形')
axes[1].set_xlabel('角度 (弧度)')
axes[1].set_ylabel('cos(x)')
axes[1].legend()
axes[1].grid(True)
axes[2].plot(x, tan_x, label='tan(x)', color='red')
axes[2].set_title('正切函数的波形')
axes[2].set_xlabel('角度 (弧度)')
axes[2].set_ylabel('tan(x)')
axes[2].legend()
axes[2].grid(True)
axes[2].set_ylim(-10, 10)
plt.tight_layout()
plt.show()
- 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
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55

参考文献