Sometimes in my calculations I got a vector with non-strict monotonic data.

E.g.: 0 0 0 50 70 90 100 or 0 10 40 60 75 85 80

As this problematic case only appears in special cases, the reason is always either some 0 values at the beginning or a decreasing at the end.

Here is my code:

interp1(sort(nanmean(TG1S(:,:,1),2)),p,0.5*max_bol)

max_bol = 95%

p = -10 -5 0 5 10 15 20

Unfortunately monotonic but not strict monotonic data also doesn't work. So sort() doesn't help (I checked all my data; sort doesn't influence my interpolation results in any case).

Is there another possibility to interpolate to get the value for 0.5*max_bol?

PS: of course also a vector like 10 20 50 50 60 70 90 would get interp1() in trouble, but this won't happen in my case, I'm sure.

More Daniel Polterauer's questions See All
Similar questions and discussions