Plot problem.. ?? No sign at all
MRAB
python at mrabarnett.plus.com
Mon Jul 5 08:49:39 EDT 2010
Ritchy lelis wrote:
> hello guys..
>
> I'm new at python programming and i'm having some problems with a
> script that i have been developing for my final project of my
> graduation.
>
> I have a script that is supposed to make a plot of a
> "Residuo" (waveform) witch is an output of a ADC ( Analogic To Digital
> Converter) for the first stage of the Flash pipiline ADC
> structure.This script doesn't show any syntax errors but it doesn't
> show no waveform at all at the plot window.
>
> I'm worried about this situation so I came here looking for help since
> I am new to the Python language.
>
>
> -----------------------------------------------------------------------
>
> 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)boboz10
>
> --------------------------------------------------------------------------------
>
Only the first 2 'if' conditions are ever true, so nothing is ever
plotted.
Also, I don't know what you're trying to do here:
elif Vi < -i/4:
because Vi is an array and i is a float. If Python ever tried to execute
it there would be a ValueError exception:
ValueError: The truth value of an array with more than one element is
ambiguous.
Use a.any() or a.all()
More information about the Python-list
mailing list