Find the increasing and decreasing point in array?
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sabarinathan Vadivelu
am 20 Feb. 2014
Kommentiert: Image Analyst
am 20 Feb. 2014
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 Kommentar
Image Analyst
am 20 Feb. 2014
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.
Akzeptierte Antwort
Azzi Abdelmalek
am 20 Feb. 2014
Bearbeitet: Azzi Abdelmalek
am 20 Feb. 2014
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])
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 20 Feb. 2014
Use the diff() function
differences = diff(yourArray);
increasing values will be positive and decreasing values will be negative.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!