Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A=[12 17 3 4] B= [ 5 8 3 1 2 3 2 4 6 ] C= [22 17 4 ] a) Assign to the variable x

ID: 2998101 • Letter: A

Question

A=[12 17 3 4] B= [ 5 8 3 1 2 3 2 4 6 ] C= [22 17 4 ] a) Assign to the variable x1 the value of the second column of matrix A. b) Assign to the variable x2 the third column of matrix B. c) Assign to the variable x3 the third row of matrix B d) Assign to the variable x4 the first three values of matrix A as the first row, and all the values in matrix B as the second, third and fourth rows. 2. If matrix A is defined using the MATLAB code A = [1 3 2; 2 1 1; 3 2 3] , which command will produce the following matrix? B= [3 2 2 1 ]

Explanation / Answer

A=[12 17 3 4];
B=[ 5 8 3 ; 1 2 3 ; 2 4 6 ];
C=[ 22 ; 17 ; 4 ];
fprintf('solving part a');
x1=A(:,2);
x1
fprintf('solving part b');
x2=B(:,3);
x2
fprintf('solving part c');
x3=B(3,:);
x3
fprintf('solving part d');
x4= [ A(1,1) A(1,2) A(1,3) ;B];
x4
fprintf('solving part 2nd question');
B= [3 2 ; 2 1 ]