If I have a vector x = (1 ,3 ,4 -2, 5 ,6 8, 9, -4, -2)
I want to create a vector with the running average such that
y[n]=1/3{x[n-1]+x[n]+x[n+1]}
Thanks.

답변 (1개)

Guillaume
Guillaume 2015년 10월 8일

0 개 추천

x = [1 ,3 ,4 -2, 5 ,6 8, 9, -4, -2]; %Please use valid notation in your question
y = conv(x, [1 1 1]/3, 'same')

카테고리

도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2015년 10월 8일

답변:

2015년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by