Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions