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;
Sum the elements in either diagonal of a square matrix
Sum of the Matrix Elements
Matlab Basics II - squares
Create an array (n,n) where only diagonal elements are '1' and others are '0'
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office