Find the increasing and decreasing point in array?

조회 수: 29 (최근 30일)
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2014년 2월 20일
댓글: Image Analyst 2014년 2월 20일
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?
  댓글 수: 1
Image Analyst
Image Analyst 2014년 2월 20일
Define "trend". Is it the start of the first increasing part of a signal where you have many rising/falling sections? Maybe you can post a screenshot of your data plotted and point out the element that you say the "trend" starts at.

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 20일
편집: Azzi Abdelmalek 2014년 2월 20일
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 toolbox
A=[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])

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 2월 20일
Use the diff() function
differences = diff(yourArray);
increasing values will be positive and decreasing values will be negative.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by