5) Write Matlab expressions to extract only the elements at odd positions in a vector (i.e. the 1st, 3rd, 5th, 7th…, elements of the vector), regardless of the length of the vector. Make sure your expression can work on vectors with odd or even number of elements.
Lets say the vector name is vec Then Matlab expressions to extract only the elements at odd positions in a vector is vec(1:2:length(vec)) Example: --------- vec = [1,2,3,4,5,6,7] Then vec(1:2:length(vec)) gives ans = 1 3 5 7 vec = [1,2,3,4,5,6,7,8] Then vec(1:2:length(vec)) gives ans = 1 3 5 7

vec(1:2:length(vec))


5) Write Matlab expressions to extract only the elements at odd positions in a vector (i.e....