adding vector entry after each element
1 view (last 30 days)
Show older comments
This is a very basic question but how would I add the elements of a vector like so...:
x = [1,2,3,4,5,6];
ans = 3 6 10 15 21
0 Comments
Accepted Answer
More Answers (1)
Sean de Wolski
on 15 Aug 2012
And just for fun:
filter(x(2:end),1,ones(1,numel(x)-1))+x(1)
See Also
Categories
Find more on Data Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!