Question
Suppose the variables data, info, and vec have been defined as follows: data = [ 2 7 4 3; 3 4 7 6; 8 3
Suppose the variables data, info, and vec have been defined as follows:
data = [ 2 7 4 3; 3 4 7 6; 8 3 5 1; 1 4 2 6; 7 2 2 5 ]; info = [ 1 2 3 4; 3 2 4 1; 2 4 1 3; 4 3 1 2 ]; vec = [ 4 1 9 5 6 3 2 7 8 ];
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
2 7 4 3 3 4 7 6 2 4 1 3 4 3 1 2
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
1 8 3 4 3 3 4 1 2 5 1 3 4 1 1 2
7. change data so that its first and fourth columns have been switched
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started