How to get average of interval from matrix

2 views (last 30 days)
There's this data [1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,19,20....1000]
From here, [1,2,3,4], [2,3,4,5], [3,4,5,6], and [4,5,6,7] I want to go forward one by one and get the average of the interval (4 intervals).
For example, in this way [2.5, 3.5, 4.5, 5.5 ...... 998.5]
How do I make it?

Accepted Answer

Matt J
Matt J on 13 Oct 2020
Edited: Matt J on 13 Oct 2020
conv(data,[1,1,1,1]/4,'valid')
or
movmean(data,4,'Endpoints','discard')

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!