how can find a point from an array where the points it follows start to decrease
显示 更早的评论
i have array contains points, somehow it exist a part of this array where are decreasing ,how can i find this part, i really need a help
采纳的回答
更多回答(2 个)
Azzi Abdelmalek
2016-2-17
%Example
t=0:0.1:20
y=sin(t)
plot(t,y)
%---------------------
ii=diff(y)>0
jj=strfind(ii,[1 0])
tout=t(jj)
yout=y(jj)
Jos (10584)
2016-2-17
A decrease is where an element is smaller than the element before it.
A = [1 2 3 4 3 2 1]
changeInA = diff(A)
isDecreasing = changeInA < 0
whereDecreasing = find(isDecreasing) % perhaps add 1 to this
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!