Enlarge vector by putting average of surrounding numbers in between of every number of original vector
1 回表示 (過去 30 日間)
古いコメントを表示
How to make a longer vector by adding an additional element between neighboring elements in the original vector. Each new element should equal the average of its neighboring elements. x = [0 2 3 2 1 -1]
3 件のコメント
採用された回答
Birdman
2018 年 1 月 17 日
x(3:2:2*numel(x)-1)=x(2:end);
for i=2:2:numel(x)-1
x(i)=(x(i-1)+x(i+1))/2
end
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!