|
From: John H. <jd...@gm...> - 2007-04-10 14:48:03
|
On 4/10/07, Iyer <mas...@ya...> wrote: > I'd like to avoid the pylab interface... > linspace is good. from matplotlib.mlab import linspace But linspace may not be what you want. Probably better: In [1]: Fs = 4. # sampling at 4Hz In [2]: dt = 1./Fs In [3]: import numpy In [4]: ind = numpy.arange(1000.) # the sample number In [5]: t = ind*dt # the sample times In [6]: t[0] Out[6]: 0.0 In [7]: t[1] Out[7]: 0.25 linspace gives a slightly different answer, because it includes the endpoint. Sometimes this is what you want, sometimes not. |