How do I take the average of every 50th term in a 2500x1 vector?
조회 수: 2(최근 30일)
표시 이전 댓글
Gaëtan Poirier 2017년 9월 15일
답변: Stalin Samuel 2017년 9월 15일
I have a 2500x1 vector and I'm trying to find if the average of the average of every 50th term equals the average of all 2500 variables.
Stalin Samuel 2017년 9월 15일
s=rand(2500,1); %2500x1 vector
Out1=mean(reshape(s,[50 50])); %mean of every 50 values
out2=mean(s(50:50:2500)) % mean of every 50th value
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!