This question is closed. Reopen it to edit or answer.
how to find a window of days in a time series data with values in a range
1 view (last 30 days)
Show older comments
nlm on 1 May 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
I have a time series data from which I need to find a window of days where the start value is >0.4 and end value is <0.2. However, the values in that window range between 0.4 and 0.2. I have this so far. However, my code is finding all values which have a decreasing trend for 10 days.
AA = data;
s = [0;diff(AA)];
ss = sign(s);
c = conv2(ss,win , 'valid');
win = ones(1,10)*-1;
p = find(conv2(ss, win, 'valid') == -1);
Ameer Hamza on 2 May 2020
Edited: Ameer Hamza on 2 May 2020
This shows the window of days in which the the value is within the specified range
data = load('data.mat');
AA = data.AA;
mask = (0.2 < AA) & (AA < 0.4);
days = find(mask); % contain the days on which the data is in range
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!