python 输出sin and cos函数曲线

sin and cos函数曲线

import numpy as np

import math

import matplotlib.pyplot as plt

#sin and cos curves

x=np.arange(0,6,0.1)

y1=np.sin(x)

y2=np.cos(x)

plt.plot(x,y1,label=’sin’)

plt.plot(x,y2,label=’cos’,linestyle=’–‘)

plt.xlabel(‘x’)

plt.ylabel(‘y’)

plt.title(‘sin & cos’) #print title

plt.legend() #print curve style

plt.show()

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年10月15日
下一篇 2020年10月15日

相关推荐