So I have two numpy arrays, each representing a series of points representing a line where the x axis is time and the y axis is some numerical measurement. The lines themselves represent measurements taken at a specific measurement value (we'll call it z) Im trying to simulate a a new line based on this data where the z value changes over time(the z remains somewhere between the two original lines.
so if the lower line represents a z of 1.0 and the higher line represents a z of 2.0, then at time t I would like to find what that value will be if z were to equal 1.6, for instance
My initial process was to take the weighted average of the line1's value at time t and line2's value at time t(where the weighting is how far each line's z value is from my z)
y_high = line_high[t]
y_low = line_low[t]
diff_high = z_for_line_high - my_z
diff_low = my_z - z_for_line_low
weighted_avg = (y_high * (diff_high / (diff_high + diff_low))) + (y_low * (diff_low / (diff_high + diff_low)))
Essentially I would step through a simulation of this data with the z changing over time, and construct a new line between the two. Does this make sense? It's all numpy btw. Is there a faster way to make this calculation that I'm not thinking of?