I have two arrays x
, y
with coordinates of a function.
Example:
x=[0,1,2,3,4,5]
y=[0,1,5,20,30,32]
pylab.plot(x,y)
shows me a smooth function for this.
Is there a way to get the x
-Value for y=3
?
regards
You should be able to use numpy.interp
for this.
eg:
numpy.interp(3.,y,x) #1.5
Note that this only works since your y values are monotonic. If your y-values aren't monotonic, there is no guarantee that your mapping of y->x is unique.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.