Suppose the variables data info and vec have been defined as

Suppose the variables data, info, and vec have been defined as follows:

Use MATLAB\'s matrix element access syntax to complete each of the following actions using only one assignment statement. you may only use MATLAB\'s matrix element access, the : operator, and the transpose (\') operator.

1. assign the transpose of the second row of data to q2a

2. assign the first 3 columns of data to q2b

3. assign the second and fourth values of the first and third row of info to q2c

4. create the matrix q2d whose first row contains the first two rows of data and whose second row contains the last two rows of info, i.e., q2d should contain

5.change vec so that the values at even-numbered indices are 0, i.e., so that vec becomes 4 0 9 0 6 0 2 0 8)

6. change info so that its second column contains the values of the third row of data, i.e., so that info becomes

7. change data so that its first and fourth columns have been switched

Solution

1 Ans) q2a=data(2,:)\'

2 Ans) q2b=[data(:,1),data(:,2),data(:,3)]

3 Ans) q2c=[info(1,2),info(1,4);info(3,2),info(3,4)]

4 Ans) q2d=[data(1,:),data(2,:);info(3,:),info(4,:)]

Suppose the variables data, info, and vec have been defined as follows: Use MATLAB\'s matrix element access syntax to complete each of the following actions usi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site