MATLAB please see image second row are the numbers 89 10 11 1213 14, the third r
ID: 3676917 • Letter: M
Question
MATLAB
please see image
Explanation / Answer
twoXThree2 = [2 2 2; 2 2 2];
3 3];
threeXTwo4 = [4 4; 4 4; 4 4];
threeXThree5 = [5 5 5; 5 5 5; 5 5 5];
threeXThree9 = [9 9 9; 9 9 9; 9 9 9];
zeroesColumn = [0 0 0];
zeroesVector = [0; 0; 0];
result = [twoXThree2; oneXThree3];
%{
result =
2 2 2
2 2 2
3 3 3
%}
% add zeroes column
result = [result [0; 0; 0]];
%{
result =
2 2 2 0
2 2 2 0
3 3 3 0
%}
% add 3x3 fives
result = [result threeXThree5];
%{
result =
2 2 2 0 5 5 5
2 2 2 0 5 5 5
3 3 3 0 5 5 5
%}
% append middle row
result = [result; [0 0 0 1 0 0 0]];
%{
result =
2 2 2 0 5 5 5
2 2 2 0 5 5 5
3 3 3 0 5 5 5
0 0 0 1 0 0 0
%}
% create matrix below middle line
lower = [threeXTwo4 [7; 7; 7]];
%{
lower =
4 4 7
4 4 7
4 4 7
%}
% add zeroes column
lower = [lower [0; 0; 0]];
%{
lower =
4 4 7 0
4 4 7 0
4 4 7 0
%}
% add 3x3 9's matrix
lower = [lower threeXThree9];
%{
lower =
4 4 7 0 9 9 9
4 4 7 0 9 9 9
4 4 7 0 9 9 9
%}
% Now add this to final result
result = [result; lower];
%{
result =
2 2 2 0 5 5 5
2 2 2 0 5 5 5
3 3 3 0 5 5 5
0 0 0 1 0 0 0
4 4 7 0 9 9 9
4 4 7 0 9 9 9
4 4 7 0 9 9 9
%}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.