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
0 0 28 36 0 0 0
0 0 30 38 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Solution
% Coppy and paste this code to matlab editor to run the code.
%%
clc
clear all
r1=2:8:34; % to define row vector-1 with range 8
r2=4:8:36; % to define row vector-2 with range 8
r3=6:8:38;% to define row vector-3 with range 8
r4=8:8:40; % to define row vector-4 with range 8
N=[r1;r2;r3;r4] % to define matrix N with row vectors
A=[(N(2:2,1:4))\' , (N(3:3,2:5))\'] % to define Matrix A using N
B=[(N(:,3))\',N(3,1), (N(3:3,2:5))] % to define Matrix B using N
C=[zeros(1,7);zeros(1,7);[zeros(1,2),N(2,4),N(2,5),zeros(1,3)];
[zeros(1,2),N(3,4),N(3,5),zeros(1,3)];zeros(1,7);zeros(1,7);]
% To define Matrix C using zeros matrix and some elements of matrix N
