From: Ritchy lelis on
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


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:

I'll be waiting.