Search code examples
pythongraph

How receive coordinates from the graph for all X range?


I have plotted four points on the x-axis from 0 to 400 because i only knew 4 coordinates on the y-axis. But I need to get the Y-coordinates for the entire X-axis, that is, for all 400 points. Does anyone know how easy it is to do this in Python? enter image description here


Solution

  • Linear interpolation works like this:

    enter image description here

    Notice that (y2-y1)/(x2-x1) is constant for all points in between.