please do on matlab
Create the 10×10 elementary matrix E that would switch the rows 3 and 7. Do not enter the matrix manually, but use the command eye to create the identity matrix and modify the appropriate entry.
For instance >> E(3,3)=0
with change the (3, 3) entry of E to 0.
Test your matrix with a random 10 × 10 matrix.
MATLAB Code:
close all
clear
clc
N = 10;
E = eye(N);
E(3,3) = 0; E(3,7) = 1;
E(7,7) = 0; E(7,3) = 1;
disp('E ='), disp(E)
% Testing
A = randi(20, N);
disp('A (Before Switching Rows) ='), disp(A)
A = E*A;
disp('A (After Switching Rows) ='), disp(A)
Output:
Get Answers For Free
Most questions answered within 1 hours.