Get the array of sum for three consecutive numbers in an array - MATLAB Cody - MATLAB Central

Problem 42457. Get the array of sum for three consecutive numbers in an array

Difficulty:Rate

Get the array of sum, for three consecutive numbers in an array.

if Input 'x' does not have at-least 3 elements then 'y' should be zero.

EX:- x = [1,2,3,4] then y = [6,9]

   x = [4,9,2,6,1,7] then y = [15,17,9,14]
   x = 1 then y = 0;

Solution Stats

60.47% Correct | 39.53% Incorrect
Last Solution submitted on Mar 02, 2025

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers71

Suggested Problems

More from this Author1

Problem Tags

Community Treasure Hunt

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

Start Hunting!