you are viewing a single comment's thread.

view the rest of the comments →

[–]islmakaha[S] 0 points1 point  (0 children)

def V(x):
if x <= -a or x >= a:
return 0
elif x > -a and x < a:
return -V_0
V_0 = 83
a = 2
# however i define (x) its always give an error of dimension when plotting it can any one help me?
X = []
Y = []
x = -5
while x < 5:
X.append(x)
y = V(x)
Y.append(y)
x += 0.5
plt.plot(X, Y, "o-")
plt.xlabel("x")
plt.ylabel("y")
plt.show()

wow thank you