Question: Help me on the marlab problem Given variable b that contains a row vector of length 10, assign the contents of the odd indices in
Given variable b that contains a row vector of length 10, assign the contents of the odd indices in b to variable odd, and assign the contents of the even indices of b to variable even. (Psst! the plural of index is indices. This has been your SAT vocabulary booster of the day) Examples: Input b = [8 -3 0 7 -6 -3 1 8 7 -2] Output odd = [8 0 -6 1 7] even = [.3 7 .3 8 -2] Solution function [odd even] = OddEvenlnd(b) %replace the line below with code to assign to variable odd the contents in the odd indices of b = [8 -3 0 7 -6 -3 1 8 7 -2]; odd = b([1, 3, 5, 7, 9)]; %replace the line below with code to assign to variable even the contents in the even indices of even = b([2, 4, 6, 8, 10]); end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
