Create the following two row vectors: d = [6 - 1 4 0 -2 5], and e = [7 5 9 0 1 3
ID: 2080649 • Letter: C
Question
Create the following two row vectors: d = [6 - 1 4 0 -2 5], and e = [7 5 9 0 1 3]. Use the two vectors in a MATLAB command to create a 3 times 3 matrix such that the first row consists of elements 2 through 4 of vector d, the second row consists of elements 3 through 5 of vector and the third row consists of elements 4 through 6 of vector d. Use the two vectors in a MATLAB command to create a 4 times 2 matrix such that the first column consists of elements 2 through 5 of vector d, and the second column consists of elements 3 through 6 of vector e.Explanation / Answer
>> d=[ 6 -1 4 0 -2 5];
>> e=[7 5 9 0 1 3];
>> A=[d([2:4]);e([3:5]);d([4:6])]
A =
-1 4 0
9 0 1
0 -2 5
>> B=transpose([d([2:5]);e([3:6])])
B =
-1 9
4 0
0 1
-2 3
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.