Question: ( 1 4 points ) Generate a vector evenNums of even numbers from 2 to 2 0 , in order. Then solve the following questions.

(14 points) Generate a vector evenNums of even numbers from 2 to 20, in order. Then solve the following questions.
(a)(2 points) Use element indexing to create a vector reverse containing the elements in reverse order, starting from the last element and ending with the first element.
(b)(4 points) Use logical indexing to remove all values that are NOT multiples of 4 from evenNums. Store your answer as multsOfFour. Hint: You can use the rem function to calculate remainders from division.
(c)(4 points) Create vectors twosAndFoursElem and twosAndFoursLog using element indexing and logical indexing, respectively, that contain all the non-multiples of 4 followed by all the multiples of 4 from the original evenNums. Your output for each method should be 2,6,10,14,18,4,8,12,16,20.
(d)(2 points) Append the even numbers from 22 to 30 at the end of the original vector evenNums. Your output should be all positive even numbers up to 30.
(e)(2 points) Remove the numbers between 10 and 18, inclusive, from evenNums. Your output should be 2,4,6,8,20,22,24,26,28,30.
 (14 points) Generate a vector evenNums of even numbers from 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!