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

vector

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

Best Answer

X= [200:-2:0] ;
X(1:2:end) = -X(1:2:end) ;