How to find the saturation point x value

I have two graphs for which I am trying to find the value at x when the y meets the saturation point. In one of those graph which is strictly non decreasing I can use findpeaks() and it gives me the satisfactory solution but that is also not helping because maybe the point is yet beyond the x-axis limit I have given (nopeakgraph attached). But the another graph has a peak point after which it starts decreasing only to get its saturation point later so findpeaks() is showing me result but that is of no use to me (peakgraph attached).
Please let me know if there is a function or a way we can find the x axis values as soon as y hits the saturation point which is when the slope becomes 0. I need to compare both the graphs as one of the graph hits saturation earlier than the other. Thanks in advance.

2 Comments

I think first you have to tell us what is your definition of 'saturation point'.
@guillaume Yes, sorry edited the question. I basically want to find when the slope becomes 0

Sign in to comment.

 Accepted Answer

a=abs(diff(y));
xvalSat=x(find(a<1e-5,1));%whatever tolerance you want here (1e-5 or less)

5 Comments

Thank you very much, David. This helps a lot.
@David, is there also any way to find the next region where the slope is 0 given my tolerance. I mean as in the peakgraph I have attached I am finding the slope 0 near that region and passing something like xvalSat =x(find(,1000)) would be a long shot to get that. How can I approximately get the next region where it starts to flatten out because I know my saturation comes later. If I could somehow use the 35k as input value of x axis where the curve has 0 slope while now it is at nearly 11k.
Look at how many 1's are being generated in:
a<tol;
x(a<tol);% will provide all the corresponding x-values
You can adjust your tol down to reduce the number of cases and find the second x-value meeting the case.
Hi @David, I am sorry I quite didn't get it. Is your a and x the same variables used in the main code or are they different variables here? I guess they are the same. But what is tol? Is it something like giving a wide range of number. Because isn't a is our tolerance which is almost close to 0 and hence we can not use it in this last code you have mentioned.
@Hi David, did I confuse you further? I was not getting if you used a as a new variable because my a was the tolerance so how are you suggesting me to use it for tot and tot is random? Like I can take 20k for tot? Please help me if you could. :)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!