I have the two following lists:
a1 = {0, 2, 4, 7, 8, 10, 11, 13};
b1 = {1, 4, 15, 8, 6, 2, 2, 1};
c1 = Thread@{a1, b1};
a2 = {0, 1, 4, 6, 8, 10, 13};
b2 = {1, 6, 12, 10, 4, 1, 1};
c2 = Thread@{a2, b2};
(a1
and a2
start and end with the same values, their lengths can be different)
producing the following figure with ListPlot[{c1, c2}, Joined -> True, Mesh -> All]
:
I would like to find the enveloped points of the two lists, so I tried:
a3 = Join[a1, a2] // DeleteDuplicates // Sort;
f[l_List] := Interpolation[l, InterpolationOrder -> 1, Method -> "Spline"]
b11 = f[c1][#] & /@ a3;
b22 = f[c2][#] & /@ a3;
env = Table[Max[#[[i]] & /@ {b22, b11}], {i, 1, Length@a3}];
ListPlot[{c1, c2, Thread@{a3, env}}, Joined -> True, Mesh -> All]
But it's not really as good as what I was hoping for.
I'm a little bit rusty, so I know that you all know a better way and correct way to do this :)
ai
. $\endgroup$