Use matlab to find the intersection of curves