Detect monotonic decrease and record the corresponding rate
Afficher commentaires plus anciens
Assume I have the following data:
D1= {'3/25/2024 15:01:10' 15
'3/25/2024 15:01:26' 25
'3/25/2024 15:01:42' 25
'3/25/2024 15:01:58' 23
'3/25/2024 15:02:14' 22
'3/25/2024 15:02:30' 15
'3/25/2024 15:02:46' 25
'3/25/2024 15:02:50' 24
'3/25/2024 15:02:59' 23}
I'd like to find the rate the variable decreases from 25 to 15. For this dataset, once the value has reached 15, it will jump back up to 25, and I'd like to record the next decreasing rate (and repeat).
So for example, I would record 10/ ('3/25/2024 15:02:46' - '3/25/2024 15:02:30') or 10/(16 seconds)
The next rate would be 10 / ('3/25/2024 15:02:59' - '3/25/2024 15:02:50') or 10/(9 seconds).
I believe I need to use ischange to detect when the values jump back up to 25, and ignore noise. (Assuming that the decreasing rate is monotonic).
Thanks
Réponse acceptée
Plus de réponses (1)
Does this help?
D1= {'3/25/2024 15:01:10' 15
'3/25/2024 15:01:26' 25
'3/25/2024 15:01:42' 25
'3/25/2024 15:01:58' 23
'3/25/2024 15:02:14' 22
'3/25/2024 15:02:30' 15
'3/25/2024 15:02:46' 25
'3/25/2024 15:02:50' 24
'3/25/2024 15:02:59' 23};
t = cell2table(D1)
var = t{:, 2};
rows15 = find(var == 15)
dateTimes = D1(rows15, 1)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!