필터 지우기
필터 지우기

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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by