Cumulative mean over constantly increasing interval
이전 댓글 표시
Hey guys, any help would be much appreciated as I'm relatively new to the program!
I've got 400000 odd rows of data and what i need to do is calculate the mean over the first 10000 points then over the first 20000 then 30000 until I've used all the data points.
The code I've written calculates the mean over each of the 400, 10000 point intervals but doesnt increase the interval size by 10000 from the original each time.
Thanks in advance
intervalLength = 10000;
x = A.data(1:4000001,2);
%create index array idx = zeros(length(x),1); idx(1:intervalLength:end) = 1; idx = cumsum(idx);
avg = accumarray(idx,x,[],@mean);
out = avg(idx);
m = avg(1:401,1); n = [1:401]; plot(n,m); xlabel('interval number'); ylabel('x_average');
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!