making a running average
显示 更早的评论
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 个评论
James Tursa
2015-10-8
回答(1 个)
Guillaume
2015-10-8
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 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!