# use of different time windows and time shift

7 views (last 30 days)
aa on 15 Aug 2020
Commented: aa on 15 Aug 2020
Hi All,
I have a problem in implementaion of for loop.
I have data in two coloumn: (a) Number of hours (b) parameter variation
I want to see teh change of paramter for diffrent time windows and diffrent time shifts and then use the output in an equation For exmaple, at first stage i want to calcualte paramter for 1 hour time window with a shift of 1 hour. then two hour time window with a shift of 1 hour, so on and so far.
then i want to calculate change in 4 hour with a time shift of 2 hour or three hours or 4 hours and so on ...
b=((u-(r).*(dt)./std
here u is the sum of enetires in each time window, r is a fix value say 0.33 ... dt is the length of tim window (2 hours or 3 or 4) and std is also fixed value say 0.5
I have to calculate the value of b for different timw windows and diffrent time shifts. (a raw data attached)

Walter Roberson on 15 Aug 2020
c = cumsum([0,data]) ;
Then for window dt with shift s
(c(dt+1:s:end) - c(1:s:end-dt)). * dt .* (r/std)
does all the slots at the same time.

aa on 15 Aug 2020
how can i save the ooutput accross the particular value
Walter Roberson on 15 Aug 2020
cell array. Your different dt and different shift are going to result in different sizes of outputs, so use a cell array to store them.
You would probably not write the results to a file because of the different sizes of results.
I do not know what you are going to do with the results that could be meaningful with the different array sizes.
aa on 15 Aug 2020
i am trying to work on the code you proposed but it did not work. May you please used the field i attached here and the calculate the outpout.