필터 지우기
필터 지우기

Averages of Vectors

조회 수: 1 (최근 30일)
Eric
Eric 2012년 3월 5일
I have a vector of temperature measurements every minute over a day and I need to convert this to a vector of 30 minute averages over the day. Any suggestions of how to do this effectively? Thanks
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 3월 5일
Where do you have the timestamp? Is it a two column matrix with first column the timestamp and the second column the measurment?
Please provide a concise example by editing your message and apply formatting.

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

채택된 답변

Thomas
Thomas 2012년 3월 5일
Since you have reading one minute apart, you should have 24*40=1440 readings. You need 48 readings, i.e. mean from 1-30, 31-60 etc.. YOu can reshape your actual vector pf readings and find the mean as follows, Suppose A is you vector of 1440 readings
b=reshape(a,30,[]); % this reshapes your vector into 48 vectors
mean(b); % this finds the mean of each
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2012년 3월 5일
Clever but not robust.
Jisha
Jisha 2012년 3월 5일
Never thought I could use reshape this way.. :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by