我是靠谱客的博主 大意小蝴蝶,这篇文章主要介绍python笔记:5.1.1matplotlib_函数绘图_多项式_图形叠加,现在分享给大家,希望可以做个参考。

# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 11:12:40 2019

@author: User
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Jun  1 23:18:28 2019

@author: User
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

a=np.array([2,-3.5,1.6,-2,9])
p=np.poly1d(a)
print(p)

x=np.linspace(-10,10,30)
y=p(x)



#plt.plot(x,y)
#plt.title('line')
#plt.xlabel("X")
#plt.ylabel("Y")
#plt.show

p1=p.deriv(m=1)
y1=p1(x)
plt.plot(x,y,x,y1)
plt.show()

运行:

   4       3       2
2 x - 3.5 x + 1.6 x - 2 x + 9

最后

以上就是大意小蝴蝶最近收集整理的关于python笔记:5.1.1matplotlib_函数绘图_多项式_图形叠加的全部内容,更多相关python笔记:5内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(112)

评论列表共有 0 条评论

立即
投稿
返回
顶部