필터 지우기
필터 지우기

Calculate the rate of change from 5 minutes interval

조회 수: 12 (최근 30일)
Ann
Ann 2021년 1월 7일
댓글: Mathieu NOE 2023년 11월 27일
Good day, everyone.
As attached is my observations data for 24 hours from different transmitter (PRN) . The data here are from 1/1/2014 to 31/1/2014. From the excel (refer attachment), I already extracted 1-minute average for all PRN in 31 days via the code below.
My problem now is how to calculate the rate of change per 5 minute from data in PRNTT1min. Already done on step 6 on managing time series for 5-mins resampling but I couldn't figure out to find the rate of change. May be the answer is already there but I am completely lost now.
Thank you in advanced.
%_______________1- Read data_______________%
data = readtable("Book_Jan.xlsx");
%___2- Convert DAY and TIME into durations___%
data.DAY = days(data.DAY);
data.TIME = days(data.TIME);
%___3- Create a datetime___%
data.TimeStamp = datetime(2014,01,01) + data.DAY-1 + data.TIME;
data.TimeStamp.Format = "MM-dd-yy HH:mm";
%___4- Convert the table to a timetable___%
dataTT = table2timetable(data,"RowTimes","TimeStamp");
%___5- Use retime to average the PRN data into 1 minute increments___%
PRNTT1min = retime(dataTT(:,["VTEC" "S4" "Sigma"]),"minutely","mean");
%___6- Round time to nearest 5 min and take unique values only___%
tt = data.TimeStamp;
tt.Minute = 5 * floor(tt.Minute/5); %5 means for 5 mins resampling
tt.Second = 0;
NEWTIMESTEP = unique(tt);
%%%%%___PROBLEM HERE___%%%%%
%___7- Find rate of change of VTEC, S4, Sigma for 5 mins___%
%%%%%___NEED HELP HERE TOO___%%%%%

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 1월 7일
hello Ann
welcome back !
here the end of the code , I don't know if the rate is per second or per minute, you to decide
%___Use retime to average the data into 5 minute increments___%
dataTT5min = retime(dataTT(:,["VTEC" "S4" "Sigma"]),"regular","mean","TimeStep",minutes(5));
%___7- Find rate of change of VTEC, S4, Sigma for 5 mins___%
all_data = table2array(dataTT5min);
rate_per_seconds = diff(all_data)/(5*60);
rate_per_minute = diff(all_data)/5;
  댓글 수: 6
Ann
Ann 2021년 1월 8일
Thank you, Mathieu. You did help me a lot.
Mathieu NOE
Mathieu NOE 2021년 1월 8일
Glad I could be of some help !!
good luck for the future !

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jason
Jason 2023년 11월 26일
how to prove in matlab: fA spherical iron ball 8 inches diameter is coated with a layer of ice of uniform thickness. If the ice melts at a rate of 14 inches3/minute, how fast is the thickness of the ice decreasing when it is 2 in.​ thick?
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2023년 11월 27일
please make a separate post if you have a new question

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by