Extract consecutive data points between 2 thresholds
조회 수: 3 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2021년 9월 8일
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 ?
답변 (1개)
KSSV
2021년 9월 7일
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
KSSV
2021년 9월 7일
From the obtained dates, calculate the diff, wherever diff is 1, those indices can be picked.
참고 항목
카테고리
Help Center 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!