[Tutor] ploting of a square well

Debashish Saha silideba at gmail.com
Sun Feb 5 14:38:14 CET 2012


from pylab import *
x=linspace(1,1000,10000)
a,b = 10,20
def v(x):
    i=5;v0=2
    for n in range(1,1+i):
        if x>(n-1)*(a+b) and x<a+(n-1)*(a+b):
            return 0
        elif x>a+(n-1)*(a+b) and x<(n)*(a+b) :
            return v0
#v=vectorize(v)
plot(x,v)
show()

Error:
x and y must have same first dimension
Question:
what is to be edited?


More information about the Tutor mailing list