element to element sum

30 Ansichten (letzte 30 Tage)
milad farshbaf
milad farshbaf am 18 Dez. 2018
Kommentiert: milad farshbaf am 18 Dez. 2018
hi
i have X = [1 5 7 6 9 2 3 1 4 8 6 5]; and i want to do [1+5 5+7 7+6 6+9 ...] how can i do that?
thanks

Akzeptierte Antwort

Matt J
Matt J am 18 Dez. 2018
X(1:end-1)+X(2:end)

Weitere Antworten (1)

Matt J
Matt J am 18 Dez. 2018
Bearbeitet: Matt J am 18 Dez. 2018
conv(X,[1,1],'valid')

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by