in [Python]

Prev: multiline input and readline
Next: High Performance solutions are needed to do things like urlretrieve
From: Ritchy lelis on 14 Jul 2010 12:37 Hello guys On Following the development of my ADC (Analog-to-Digital converter Residue function transference) i already got some progress with the plot problem and (much thanks to colleagues who help me in this forum and not only) i would like to show you all the progress that has already got and take the opportunity to leave some doubt: ------------------------------------------------------------------------------------- import numpy import matplotlib.pylab as plt Vref = numpy.arange(-20, 20, 0.2) Vi = numpy.arange(-10, 10, 0.1) V0 = numpy.arange(Vi.shape[0]) i = 0 while i < Vi.shape[0]: if Vi[i] > Vref[i]/4: V0[i] = 2*Vi[i]-Vref[i] elif (-Vref[i]/4)<= Vi[i] and Vi[i] <= Vref[i]/4: V0[i] = 2*Vi[i] elif Vi[i] < -Vref[i]/4: V0[i] = 2*Vi[i] + Vref[i] i = i + 1 plt.plot(V0) # this plot will make that seems stairs rising plt.show() ----------------------------------------------------------------------------------------- For now i have a draw that seems cool to initialize the second part of my objectives but anyway i would like to request some help because I'm not getting on the waveform to start at origin of the coordinate axes. I'm looking for a better way to create those initial vectors (Vi, Vref, V0), any sujestions? Forword i want them to be implemented as a function that in the start of the program, i ask the user the dimention of the arrays that they want to use. Also if you have any sujestions to improve the script you can drope it here, is always welcome. For who want's to help but donĀ“t have much information about what i'm doing here it's a link that is pretty cool: http://www.eit.lth.se/fileadmin/eit/courses/eti220/files/lectures/2009/lec4..pdf I'll be waiting. Cheers. Ritchy. |