Write program scripts using matlab to obtain the following a
Write program scripts (using matlab) to obtain the following answers. Make sure that in your code you create the matrix N. Then, you use the matrix N and proper commands for the matrices A, B and C, not simply assigning each element value.
Consider the following N matrix
2 10 18 26 34
4 12 20 28 36
6 14 22 30 38
8 16 24 32 40
Consider the matrix A=
4 14
12 22
20 30
28 38
Consider the matrix B= [18 20 22 24 6 14 22 30 38]
Consider the matrix c=
0 0 0 0 0 0
0 0 0 0 0 0
0 0 28 36 0 0
0 0 30 38 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Solution
clc
clear all
N = zeros(4,5);
temp = 0;
for j = 1:5
for i = 1:4
N(i,j) = 2+temp;
temp = N(i,j);
end
end
N
A = zeros(4,2);
k = 0;
for j = 1:2
for i = 1:4
A(i,j) = N(j+1,i+k);
end
k = k+1;
end
A
B = zeros(1,9);
B(1:4) = N(:,3);
B(5:9) = N(3,:);
B
C = zeros(6,6);
C(3:4,3:4) = N(2:3,4:5);
C

