- 实验内容
1、题目
正余弦函数图像.
2、实验代码
- import numpy as np
- import matplotlib.pylab as pl
- import matplotlib.font_manager as fm
- from matplotlib.font_manager import FontProperties
- def getChineseFont():
- return FontProperties(fname='/System/Library/Fonts/PingFang.ttc')
- t=np.arange(0.0,2.0*np.pi,0.01)#自变量取值范围
- s=np.sin(t)
- z=np.cos(t)
- pl.plot(t,s,label='正弦',color='red')
- pl.plot(t,z,label='余弦',color='blue')
- pl.xlabel('x-变量',fontproperties=getChineseFont(),fontsize=18)
- pl.ylabel('y-正弦余弦函数值',fontproperties=getChineseFont(),fontsize=18)
- pl.title('sin-cos函数图像',fontproperties=getChineseFont(),fontsize=24)
- pl.show()
3、运行结果
二、实验报告
请同学们每次实验记得签到,把每次上机的内容保存好,将所有的实验内容压缩为:学号+姓名,统一发给班长,第16到17发送到:346697954@qq.com邮箱。