Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1} - MATLAB Cody - MATLAB Central

Problem 44886. Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1}

if v1 is [1 2 3 4 5 6 7 8] then v2 should be [3 5 7 9 11 13 15].

if v1 is [1; 3; 5; 7] then v2 should be [4; 8; 12].

Solution Stats

48.86% Correct | 51.14% Incorrect
Last Solution submitted on May 08, 2025

Solution Comments

Show comments

Problem Recent Solvers160

Suggested Problems

More from this Author4

Problem Tags

Community Treasure Hunt

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

Start Hunting!