How to find the intersection point of two lines exactly, the lines are generated using some data. The x-axis is on the logarithmic scale and the y-axis is on a linear scale.

    sd1 = Subdivide[0.001, 0.5, 300];
    sd2 = Subdivide[0.55, 2, 300];
    sd3 = Subdivide[2.2, 100, 300];
    sd = Flatten[{sd1, sd2, sd3}];
    sd = sd[[1 ;; All ;; 8]];
    data1 = Transpose[{sd, a}];
    data2 = Transpose[{sd, b}];
    ListLogLinearPlot[{data1, data2}, Joined -> True, PlotRange -> All]

2 Answers 2


Here I show a tricky direct solution using Graphics`Mesh`FindIntersections which doesn't need interpolation:

pic=ListLogLinearPlot[{data1, data2}, Joined -> True, PlotRange -> All];
p=Graphics`Mesh`FindIntersections[pic[[All, 2]]  ]    
(*{{0.841204, 8.84133}}*)  


Show[{pic, Graphics[{Red, PointSize[.025], , Point[p]}]}]

enter image description here

The x value of the intersection evaluates to

  • $\begingroup$ @Ulrich Neumann It is not working form me, I am using mathematica v11.3. and the result of the previous solution and the solutions you got are different $\endgroup$
    – acoustics
    Commented Oct 18, 2019 at 3:19
  • $\begingroup$ @acoustics I don't know your previous result, but the intersectionpoint seems to be ok (see my modified answer). Keep in mind the different coordinates! $\endgroup$ Commented Oct 18, 2019 at 6:36
  • $\begingroup$ I also got the same result but which one I have to consider 2.31916 or 0.841204. $\endgroup$
    – acoustics
    Commented Oct 18, 2019 at 6:57
  • $\begingroup$ Probably the last one, if you want the result in the coordinate-system of data1, data2 $\endgroup$ Commented Oct 18, 2019 at 7:00
  • 1
    $\begingroup$ Take 2.31916 or alternatively use pic=ListLinePlot[...] in my answer $\endgroup$ Commented Oct 18, 2019 at 7:11

I would generate an InterpolatingFunction for each dataset and then find the intersection with FindRoot:

FindRoot[Interpolation[data1][x] - Interpolation[data2][x], {x, 1}]

FindRoot will look for the root of the given function closest to the provided starting point (in this case: 1).

  • $\begingroup$ Is it Log value or the normal value, I got an answer which is around 2.304, I am get little confused what value is it. $\endgroup$
    – acoustics
    Commented Oct 17, 2019 at 11:27
  • 1
    $\begingroup$ The way you plot the data (in this case on a logarithmic chart) does not affect the data itself. So it's the normal value. $\endgroup$
    – banone
    Commented Oct 17, 2019 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.