필터 지우기
필터 지우기

moving average at matrix data

조회 수: 5 (최근 30일)
Daniel Christover
Daniel Christover 2022년 5월 11일
댓글: Prakash S R 2022년 5월 11일
how do i find the moving average or running mean from my data ?

답변 (1개)

Prakash S R
Prakash S R 2022년 5월 11일
  댓글 수: 2
Daniel Christover
Daniel Christover 2022년 5월 11일
how can i add this command ?
Prakash S R
Prakash S R 2022년 5월 11일
That depends on what your data looks like. You are not giving much information to help us help you..
Have you been able to read the data into a Matlab as an array?
Let us say you were able to read the .txt file and construct a matrix A with 43 rows and 13 columns
What do the rows and columns represent? If I were to guess, I'll say that the columns are months, and the data is not really a matrix, but represents a single time-seies of 516 consecutive months. I guess you are interested in doing a moving window average over a certain number of months. Am I correct? If not, stop reading the rest of the comment!
If so, your first task is to convert your 43x13 matrix into a 1x516 vector, by dropping the first column (of year numbers) and then reshaping the 43x12 matrix (ROW-WISE!!) into a 1x516 vector B.
After that, doing the moving average of 4 months is simply
avgB = movmean(B,4)

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by