I want to find :
- all local maxima in range
- all local minima in range
From those points I can interpolate and combine functions upper and lower boundary. What I am really interested in, is the mean function of those boundaries.

Data model for this plot:
GetRLine3[MMStdata_, IO_: 1][x_: x] := ListInterpolation[#, InterpolationOrder -> IO, Method -> "Spline"][x] & /@ (({{#[[1]]}, #[[2]]}) & /@ # & /@ MMStdata); data = Transpose[{# + RandomReal[]*0.1 & /@ Range[-10, 30, 0.4], Tanh[#] + (Sech[2 x - 0.5]/1.5 + 1.5) /. x -> # & /@ Range[-4, 4, 0.08]}]; xLimits = {Min@#1, Max@#1} & @@ Transpose[data]; f = D[GetRLine3[{data}, 3][x], x]; Edit: As my effort:
minimums = DeleteDuplicates[Round[x /. Last[FindMinimum[f, {x, #}]] & /@ Transpose[data][[1]], 0.0001]] minimumvalues = (f /. x -> #)[[1]] & /@ minimums; minimumData := Transpose[{minimums, minimumvalues}]; maximums = DeleteDuplicates[Round[x /. Last[FindMaximum[f, {x, #}]] & /@ Transpose[data][[1]], 0.0001]]; maximumsvalues = (f /. x -> #)[[1]] & /@ maximums; maximumsData := Transpose[{maximums, maximumsvalues}]; maxf = Max[{GetRLine3[{maximumsData}, 3][x], f}] minf = Min[{GetRLine3[{minimumData}, 3][x], f}] mf = Mean[{maxf, minf}] This was what I was trying to make: 
I still get quite few warnings and I'm sure it's not the best solution. I don't like the DeleteDuplicates@Round@ part, but it was necessarily to get the interpolation function working.






