If I have a data like the attached image.
I need to draw a vertical line (like the red dashed line) at the max point of the green part (positive trend) which is followed by a strong negative trend.
And another vertical line at the starting point (the turning point) of the negative trend on the purple part.
I tried the diff function, but I didn't get what I need.
Could you please tell me how to do this in MATLAB?