Plot problem.. ?? No sign at all
Alan G Isaac
alan.isaac at gmail.com
Mon Jul 5 10:38:04 EDT 2010
On 7/5/2010 7:45 AM, Ritchy lelis wrote:
> from pylab import*
>
> Vref = arange(1, 20, 0.02)
> Vi = arange(1, 10,0.1)
>
> for i in Vref:
> for n in Vi:
> if n> i/4:
> V0 = 2*n-i
> elif (-i/4)<= n and n<= i/4:
> V0 = 2*n
> elif Vi< -i/4:
> V0 = 2*n+i
> else:
> print "Try Again"
> ##print V0
> plot (V0)
Your data manipulations don't make sense to me,
and plotting one point at a time is probably
not what you want to do. As a rule, use arange
only with integer arguments. Finally, if you
want to see your plot, you need to show it
(or save it). So create an **array** V0 and
then do something like the following:
import numpy as np
import matplotlib.pyplot as plt
Vref = np.linspace(1,20, 1000)
Vi = np.linspace(1,10,100)
#replace the next line
V0 = ... #create an array
plt.plot(V0)
plt.show()
hth,
Alan Isaac
More information about the Python-list
mailing list