This question already has an answer here:

I have two Listsoflist containing x and y coordinates. Now, I want to plot the two profiles, show their intersection and find the area of each intersecting region. I have used interpolating function to find the plots but unable find intersection point.


marked as duplicate by Henrik Schumacher, Johu, Community Oct 2 '18 at 17:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Can you please provide us with the two lists, so that we can use them in the answer? $\endgroup$ – Fraccalo Aug 22 '18 at 18:33
  • 2
    $\begingroup$ Then create a fake test case for us that has the same structrure, but is smaller. $\endgroup$ – Marius Ladegård Meyer Aug 22 '18 at 19:20
  • $\begingroup$ This is one of your first posts and I'm going to create data for you, but you should really provide a sample of your data for allowing SE community to help you with your problem. $\endgroup$ – Fraccalo Aug 22 '18 at 19:28

Creating fake data for example

list1 = {Range[20],Join[Range[10] + RandomReal[1, 10],10 - Range[10] + RandomReal[1, 10]]}//Transpose;
list2 = {Range[20],Join[10 - Range[10] + RandomReal[1, 10], Range[10] + RandomReal[1, 10]]}//Transpose;

Interpolating them:

f1 = Interpolation[list1];
f2 = Interpolation[list2];

Finding intersections:

roots = {FindRoot[f1[x] - f2[x] == 0, {x, 5}], 
   FindRoot[f1[y] - f2[y] == 0, {y, 15}]} // Flatten

{x -> 5.12575, y -> 14.9835}

Showing the plot:

 ListLinePlot[{list1, list2}, 
  Filling -> {2 -> {{1}, {LightBlue, Transparent}}}]
 ListPlot[{{x, f1[x]}, {y, f1[y]}} /. roots, PlotStyle -> Blue]

enter image description here

Integrating for finding the area:

NIntegrate[f1[z] - f2[z], {z, x, y} /. roots]