create a vector which counts down from 200 to 0 by two. How to make every other being negative

15 vues (au cours des 30 derniers jours)
create a vector which counts down from 200 to 0 by two with every other entry being negative I already can create a vector from 200 to 0 by 2: X= [200:-2:0] How to make every other entry being negative

Réponse acceptée

KSSV
KSSV le 1 Sep 2017
X= [200:-2:0] ;
X(1:2:end) = -X(1:2:end) ;

Plus de réponses (0)

Catégories

En savoir plus sur Dynamic System Models dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by