Time axis based on the last 24 hours - matlab

I am trying to find a way to make my axis go from a certain time to the same time 24h later.
What I mean is that I am taking measurements for the last 24 hours and I want my axis to be limited and have certain ticks.
More specifically, I get measurements which start at 10am on the 1st of Nov and it finishes at 10am on the 2nd of Nov.
And i want my axis to go from 10 to 24 / 00 to 10 with 1h steps (ticks).
Any suggestions on how to do that are more than welcome.
Thanks a lot for your time.

Related

Trending Percentage over time

When I am trying to calculate a percentage over time with the rolling weighted denominator, what is that called? The calculation is basically
Users With WiFi Activity/Users
The line graph that I have is graphed daily on the x axis but at each day, it is only calculating the day of so the percentage is extremely lower, but what I want is on the line graph, on day, the percentage of WiFi users rolling 30 up to that day is this % vs only day x $.
Is that called a moving average?
Also, how is that calculate?
What Data should look like
Day Percentage SUMTotalWiFiUsersRolling SumTotalUsersRolling
8/1 85% 1800 2000
8/1 81% 1700 2100
What Tableau is doing
Day Percentage SUMTotalWiFiUsersDayOnly SumTotalUsersRolling
8/1 30% 600 2000
8/1 35% 735 2100
You're right, that is a moving average. MA since the day that you're fixing the 30 days period at is moving (each new day the window jumps by one day forward)
Is your data at the day level of detail? If so, this is the table calc you need:
WINDOW_AVG([SUMTotalUsersRolling],-29,0)
In the formula, we're starting at 29 days backwards from this day (0). So the 30 day average is including today
Formula format:
WINDOW_AVG(<field to average>,<number of periods to start from>,<period to end at>)

PostgreSQL: Calculate elapsed hours across time change

How can I calculate the number of hours between two times, taking into account the change from standard to daylight savings time between them?
I need to determine which crew is working in my customer's plant. There are four possibilities, changing in a known order from one to the next every four days, so the crew pattern recurs every 16 days. I had planned to store a reference time in my database. To calculate the crew, I would calculate the elapsed hours between the reference time and the current time, modulo it by 384, and use crew A if the result is below 96, crew B for 96-192, and so on.
I am pretty sure that in the spring, when an hour is repeated at the time change, the crew shift is 13 hours long, and in the fall, the crew shift is only 11 hours long. My scheme, at least if it relied on timestamp with time zone objects, would be wrong for an hour every shift for half the year.
Thank you.

Find and Rank Time Series MATLAB

I know there must be a simple way that I can learn to do this but I cannot imagine how to start. I am tasked with finding a top 10 matching daily wind power time series in a 30-day plus/minus window from the first day in the time series (Jan 1st) matching a single daily wind power time series and it is out of my level of experience in MATLAB. I have successfully done this matching a single time series of the current year with the exact calendar days from previous years, but I need a more robust searching method to find the best correlated time series in a +/- window of time. For example, I'm comparing a 120 day time series (without leap years) with 25 previous years during the same 120-day period (Jan-Apr). The end result will show me the top 10 time series with the years and Julian day or cumulative day listed and a correlation or RMSE value associated with it. My data looks like this arranged in a 365 (days) X 25 (years) array and I thank you very much for your help!
1182573 470528 1638232 2105034 1070466 478257 1096999
879997 715531 1111498 1004556 1894202 1372178 1707984
636173 937769 2119436 742710 1625931 1275567 1228515
967360 1103082 2218855 1643898 1822868 554769 1325642

MATLAB Datenum does not work properly with find

I have two sets of time series data which are collected with different time intervals. One is measured every 15 minutes and the other every 1 minute.
The measured variables are oxygen concentration, oxygen saturation and time, all three of which are measured using the two different instruments which have the different time intervals (6 column arrays in total).
I have two times between which I want to find the index's of all the entries at 15 minute intervals in the time column that sit between them.
co=1;
for i = datenum('03/11/2014/10/00/00','dd/mm/yyyy/HH/MM/SS'):datenum('03/11/2014/00/15/00','dd/mm/yyyy/HH/MM/SS')-datenum('03/11/2014/00/00/00','dd/mm/yyyy/HH/MM/SS'):('03/11/2014/16/00/00','dd/mm/yyyy/HH/MM/SS');
u=find(xyl_time==i);
New_O2(co,1)=xyl_o2conc(u);
New_O2(co,2)=xyl_o2sat(u);
v=find(sg_time==i);
New_O2(co,3)=sg_o2conc(v);
New_O2(co,4)=sq_o2sat(v);
co=co+1;
end
however, this does not work. I have narrowed it down and its something to do with the time interval that I'm using. I want it at every 15 minutes, but when I produce the 15 minute interval and then datestr that number, it comes up with '12:15AM'. I think this is causing the problem, but have no idea how to produce just times alone i.e I just want 00:15 not 12:15 not 00:15 AM or PM. just spacings of 15 minutes for my for loop.

Calculate Percentage Overtime in SSRS 2012

I am trying create a report that calcualtes the Overtime someone has worked in a week, my understanding of the calulation would be.
My Columns are :
Extra Hours Worked Per Week
Total Hour Worked Per Week
Calculation
Extra Hours Worked Per Week / (Extra Hours Worked Per Week + Total Hour Worked Per Week) * 100
If I represent All the columns as minutes sum them up and do the calculation I get one figure but if I sum up all the minutes in to hours and minutes and do the same calculation I get a different figure. What I want to know is, is the Calculation correct and if so, should I be doing the calculation just using minutes or using hours and minutes.
Hope someone can help.
Assuming you want to calculate the percentage of Extra hours, your calculation should be:
((TotalHours * 100)/(TotalHours - ExtraHours))-100
And my advise to you is to keep the calculation in minutes, and in the end convert it to hours (and minutes).