You might think that calculating intersection points is pretty
trivial but there are complications in computing that you don't
get in math
2 straight lines
If you run
x=[1 2 3]
y1=[ 0 1 2]
y2=[2 1 0]
you'll see that the lines cross at x=2, y=1. Using maths
- Find eq of lines and solve
- x(y1-y2==0) - good because it can find lots of points.
x(y1-y2==0) prints the x values where the y values are the same
Problem 1: precision
Problem 2: precision - close lines
Problem 3: intersection not at a datapoint
You'll see that the lines clearly cross twice, but they don't
cross at one of the plotted points, so y1-y2 is never 0.
We need to interpolate the values, but to do that we need to
make assumptions about the nature of the data - should the points ...
be connected by straight lines or curves? If curves, what type?
In general the data's likely to come from an experiment. If the
2 sets of data don't share the same same of xcoordinates there are