Question: For these exercises, do not use the direct entry method to construct the vectors. Write a script that does the following: Construct a vector, fours

For these exercises, do not use the direct entry method to construct the vectors. Write a script that does the following:

Construct a vector, fours, containing every fourth number starting with 0 and ending at 32.

Construct a vector, reverseEven, containing numbers starting at 20 and counting backward by 2 to 0.

Constructavector,random,containing10randomlygeneratednumbers between 60 and 100.

Use the build in function to get the average of all numbers in odds, fours and rerverseEven. ((sum of fours + sum of reverseEven)/the number of all elements)

You are given a vector grade stores test scores, defined as: grade = [56 82 110 92 95 86 -56 89 -10 102].

a) You decide that elements less than 0 or greater than 100 are invalid. Write a script to remove all of the invalid numbers from grade. You should alter the vector grade rather than storing your answer in a new variable. Since your commands must work for any vector of any length, you must not use direct entry.

b) Based on the result you got from a). You wish to normalize these scores by computing a new vector, normGrades, which will contain the test scores on linear scale from 0 to 100. A zero still corresponds to a zero, and the highest test score will correspond to 100. For example, if tests = [90 45 76 21 85 97], normTests should be [92.78 46.39 78.35 21.65 87.63 100];

Write a script that, when given a vector of numbers named nums, creates a vector newNums containing every other element of the original vector, starting with the second element. For example, if nums = [6 3 56 7 8 9 445 6 7 437 357 5 4 3] , newNums should be [6 56 8 445 7 357 4].

Note: You must not simply hard-code the numbers into your answer; your script should work with any vector of numbers. (Page 57, Example listing 3.1)

You are given an array A, defined as: A = [1 3 12; 2 5 18; 3 6 12]. Write a script to find out the location (index) of the largest and smallest element in the array.

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!