【发布时间】:2021-05-07 16:01:32
【问题描述】:
这是我关于 stackoverflow 的第一个问题,如果我遗漏了一些数据,他们会告诉我,我需要的是使用 python 语言创建一个函数图,但我没有找到有关如何执行此操作的信息,我找到了如何制作图表但不限制功能
我需要在 python 中绘制的图形类似于此函数的范围
这是函数
{ V₁x 0 ≤ x < a
{ V₁x - q(x-a)/2 a ≤ x ≤ a+l # probably it's q(x-a)²/2
M(x) = { V₂(L-x) a+l < x ≤ L
{ 0 otherwise
from matplotlib import pyplot as plt
x1 = [40, 50, 60, 70, 80, 90, 100]
y1 = [40, 50, 60, 70, 80, 90, 100]
plt.plot(x1, y1)
plt.xlabel('Like Geeks X Axis')
plt.ylabel('Like Geeks Y Axis')
axes = plt.axes()
axes.set_xlim([4, 8])
axes.set_ylim([-0.5, 2.5])
plt.show()
【问题讨论】:
-
这能回答你的问题吗? Plot Piecewise Function in Python
-
Andres,¿ 你确定区间
a<x<a+l的公式吗?在我的知情理解中,应该是V1*x-q*(x-a)²/2... -
@sophros 据我了解,您引用的问题是关于表示具有单点不连续性的函数的(被误解的)方式,因此此处给出的答案不适用。
标签: python matplotlib graph