movsum 関数を使うと、移動合計値を簡単に算出することができます。以下はその一例です。
% Sample data
data = rand(100,1);
% Apply movsum
dataSum = movsum(data,5,'Endpoints','discard');
% Visualize the result
figure
plot(dataSum)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!