I have data that look like this:
These are curves of the same process but with different parameters.
I need to find the index (or x
value) for certain y
values (say, 10
).
For the blue curve, this is easy: I'm using min
to find the index:
[~, idx] = min(abs(y - target));
where y
denotes the data and target
the wanted value.
This approach works fine since I know that there is an intersection, and only one. Now what to do with the red curve? I don't know beforehand, if there will be two intersections, so my idea of finding the first one and then stripping some of the data is not feasible.
How can I solve this?
Please note the the curves can shift in the x
direction, so that checking the found solution for its xrange
is not really an option (it could work for the data I have, but since there are more to come, this solution is probably not the best).