Plot problem.. ?? No sign at all

Johan Grönqvist johan.gronqvist at gmail.com
Sun Jul 11 08:28:54 EDT 2010


2010-07-11 02:12, Ritchy lelis skrev:
> On 7 jul, 08:38, Johan Grönqvist<johan.gronqv... at gmail.com>  wrote:
>
> About the plot draw it's a curve that it's a set of points wich it's
> the result of the comput of the Vref and Vi together. I don't know if
> i had to make a break instruction (like in other's languages) after
> the "If" instructions if i want the else-condition to be executed? ...
> (do you have some sujestions?)

I would have expected a code structure similar to this:

(NOTE: This is a very inefficient solution, and not the one suggested 
earlier, but it is closer to the code snippet you posted originally, and 
it does produce a plot.)

----------------------
import numpy as np
import matplotlib.pyplot as plt
Vref = np.linspace(1,20, 100)
Vi = np.linspace(1,10,100)

for ref in Vref: # Loop over Vref and Vi
     for i in Vi:
         if  i > ref/4: # Compute V0
             V0 = 2*i-ref
         elif (-ref/4) <= ref and ref <= ref/4:
             V0 = 2*i
         elif i < -ref/4:
             V0 = 2*i+ref
         plt.plot(i, V0, ".") # Plot one single point at x = i, y = V0
plt.show() # Display the plot in a window
----------------------


> Anyway i have a picture of a tuturial that i found but in this forum i
> can't post it. That pic would show what a really want...

Can you give a link?

>
> Relatively to the axis, the Vi takes the x-axis and the Vref takes the
> y-axis.


To me this sound like you want to make a 3D-plot, as there is the 
x-axis, the y-axis, and V0. Is this correct? Is V0 on a z-axis?

>
> As i said, i have a good 2 pic of a doc that has the information about
> this ADC that i'm developing.
>

I looked on wikipedia 
<http://en.wikipedia.org/wiki/Analog-to-digital_converter>, and saw some 
figures. Is any of those similar to what you look for?

I see that they have (Vi - Vref) on the x-axis, and the computed value 
on the y-axis.

Regards

Johan




More information about the Python-list mailing list