フィルターのクリア

How to use loop function to find the 1st to Nth elements' average, and then 2nd to Nth element's average? Thanks

1 回表示 (過去 30 日間)
Hi guys thanks for helping me. Suppose i have 700 data in a column, and i want to find out the first 120 elements' average. Then starting from this point, i want to find out the average of the sum of from 121st to the 700th, then from 122nd to 700th and so on. I know i have to use iteration to solve this, but i fail to set up a good algorithm and required syntax.
I am beginner of Matlab, please help me, thank you !!

採用された回答

dpb
dpb 2016 年 9 月 30 日
Navg=120; % number for moving average
krnl=ones(N,1)/N; % convolution kernel over N elements
xfilt=conv(x, krnl, 'valid') % filtered mean result over valid elements

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by