MATLAB: Find the increasing and decreasing point in array array I have an array. Which is increasing. At one point it starts decreases. This trend starts repeating many times in array. How to find that point in array where the trend starts? Best Answer A=[1 2 3 2 1 4 5 6 7 5 2 0 4 5 6 10][peaks,idx]=findpeaks(A)If you haven't a signal processing toolboxA=[5 2 3 2 1 4 5 6 7 5 2 0 4 5 6 10]d=sign([0 diff(A)]);idx=strfind(d,[1,-1]) Related SolutionsMATLAB: The difference in an array sum(abs(diff([5 3 6 1 5 1 6 7 3]))) MATLAB: How can find a point from an array where the points it follows start to decrease Assumption : there is on only one decreasing region in your data points.x = -2:0.1:6;y = x.^3-5*x.^2+5*x-2;D = diff(y);decreaseStart = find(D<0,1,'first');decreaseEnd = find(D<0,1,'last');plot(x,y)hold on plot(x(decreaseStart:decreaseEnd),y(decreaseStart:decreaseEnd),'r'); Related QuestionHow to randomize elements in an array by a set amountHow can i have subvectorsCheck for decrease and increaseSorting and replacing data in matlab
Best Answer