Question: 8. Let x = [3 1 5 7 9 2 6]. For each of the following commands first think about what the result should be

8. Let x = [3 1 5 7 9 2 6]. For each of the following commands first think about what the result should be and then type the command and verify your answer. a. x(3) b. x(1:7) c. x(1:end) d. x(1:end-1) e. x(6:-2:1) f. x([1 6 2 1 1]) g. sum(x)

10. Given that x = [1 5 2 8 9 0 1] and y = [5 2 2 6 0 0 2], execute and explain the results of the following commands: a. x > y b. y < x c. x == y d. x <= y e. y >= x f. x | y g. x & y h. x & (~y)

11. Given x = [3 15 9 12 -1 0 -12 9 6 1], provide the command(s) that will a. set the values of x that are positive to zero b. set values that are multiples of 3 to 3 (rem will help here) c. multiply the values of x that are even by 5 d. extract the values of x that are greater than 10 into a vector called y e. set the values in x that are less than the mean to zero f. set the values in x that are above the mean to their difference from the mean In each of the following questions, write down on paper the result of the given MATLAB code fragments for each of the cases indicated. Then use MATLAB to check your answers.

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!