Extract consecutive data points between 2 thresholds
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
For a project, i have data in the form of wind speed (m/s) recorded with 1 minute intervals, starting from 2009 through to 2021. For the time of each recording I have created a datetime array in the form of yyyy:MM:dd_HH:mm:ss, and for the wind speed recorded at each minute i have created a double array.
The wind speed ranges from 0 through to 40+ m/s. For the project, any wind speeds above 30m/s will cause damage to some machinery and hence, occurances where windspeed exceeds 30m/s must be recorded. Additionally, for each case where wind speed data exceeds 30m/s, i need to find the time taken (in minutes based on the datetime data) for the wind speed to go from 20m/s to the 30m/s limit. So the extracted data points between 20 and 30 m/s must be consequtive, which will allow me to find the time taken for cases where wind speed gradually increases from 20 to 30 m/s. Im not too fussed on the method used to extract the data with said conditions, so any sort of direction/help would be greatly appreciated.
4 Commenti
Walter Roberson
il 8 Set 2021
Should there be a sliding window (what width?) in which the condition is set true if mean() over the window is > 30, or median() over the windows is > 30, or if count of (data>30) is > 1 ?
Risposte (1)
KSSV
il 7 Set 2021
Let t be your dates in datetime format and w be your wind data.
% get indices of wind lying in [20, 30]
idx = w>= 20 & w <= 30 ; % results into logical indexing
t1 = t(idx) ; % extract those dates
w1 = w(idx) ; % extract the wind data
2 Commenti
KSSV
il 7 Set 2021
From the obtained dates, calculate the diff, wherever diff is 1, those indices can be picked.
Vedere anche
Categorie
Scopri di più su Time Series Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!