I would like to write a computation that will take a vector of 1xN length and then add adjacent matrix values .

1 vue (au cours des 30 derniers jours)
I would like to write a computation that will take a vector of 1xN length and then add adjacent matrix values .
e.g. [a+b,c+d,e+f,g+h,....etc]
My thoughts were to write something along the lines of n-(n-1), n-(n-2) to calculate this step.
However I don't want to continuously write this for a N=256 row.
How could I do this?

Réponse acceptée

Stephen23
Stephen23 le 15 Déc 2018
Modifié(e) : Stephen23 le 15 Déc 2018
Where V is your vector (containing an even number of elements):
V(1:2:end)+V(2:2:end)

Plus de réponses (0)

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by