mean of matrix elements
조회 수: 1(최근 30일)
hey all. i have a 5760x1 matrix. i need to find the average of the first 10 elements, remove the 10 elements and replave with the averaged number, find the average of the next 10 elements, remove those 10 elements and replace with average and so on.... could anyone give me an insight as to how to do this? much appreciated john
Andrew Reibold 2014년 10월 15일
편집: Andrew Reibold 2014년 10월 15일
myMatrix = rand(5760,1)
for jj = 1:576
moving_avg(jj,1) = mean(myMatrix(jj*10-9:jj*10));
Will make a matrix called 'moving_avg' where each point represents the average of each set of 10 points.
Is that what you wanted? It will be 1/10 the size.
Andrei Bobrov 2014년 10월 16일
I want have 'vote' too!
out = accumarray(ceil((1:numel(x))'/10),x(:),,@mean);