2024/5/24

 

复制代码
import numpy as np
import matplotlib.pyplot as plt

# 生成x的取值范围
x = np.linspace(0, 10, 100)

# 计算y1、y2和y3的值
y1 = x * x
y2 = np.cos(2 * x)
y3 = y2 * y1

# 绘制y1、y2和y3曲线
plt.figure(figsize=(8, 6))

# 在同一坐标系下用不同的颜色和线型绘制曲线
plt.plot(x, y1, 'r-', label='y1')
plt.plot(x, y2, 'g--', label='y2')
plt.plot(x, y3, 'b-.', label='y3')
plt.legend()

plt.xlabel('x')
plt.ylabel('y')
plt.title('Plot of y1, y2, and y3')

plt.show()
复制代码

 

posted @   The-rich  阅读(5)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示