Question: Must be done using MATLAB. Please add comments next to code to indicate purpose of function (or what function/code is doing). Thanks in advance. Exercise
Must be done using MATLAB. Please add comments next to code to indicate purpose of function (or what function/code is doing). Thanks in advance.

Exercise 1 (4 points) In this exercise you will create the three types of elementary matrices, analyze their properties, and perform elementary row-operations on matrices by using the elementary matrices. (a) *Write three functions in MATLAB function El-elel (n,ri.j) function E2-ele2 (n,i,j) function E3-ele3 (n,j.k) The functions create elementary nxn matrices that correspond to the elementary row operations, namely, row replacement, row interchanging. and row scaling. You should start with the identity matrix eye(n). Matrix El is obtained from eye(n) by replacing (row/) with [(rowj) + (row i) Matrix E2 is obtained from the matrix eye(n) by interchanging rows i and j. Matrix E3 is obtained from eye(n) by multiplying row j by k Type the functions in your diary file type elel type ele2 type ele3 Part I *Run each of the three created function forn 4 r3; i2, j-4; k-5; Your outputs must be three matrices El, E2, E3 for the indicated variables and you will be working with them in this part of the Exercise. %Write a comment how each of these matrices was generated from the matrix eye(4). Calculate the determinant of cach of the elementary matrices E1, E2, E3 det(El), det(E2), and det(E3). Output them. % Comment within your diary file whether the determinants, which you have calculated, are different form the determinant of the original identity matrix and what is the difference. *Type the matrix M=magic(4) in your diary file Left multiply matrix M by each of the output matrices El, E2, E3 (one at a time). Output the three products. % Comment on how matrix M has been modified after performing each multiplication. Part II Within your diary file, create a matrix A by starting with eye(5) and performing the following sequence of elementary row-operations: first, replacing (row 2) with [(row 2)+ row 4)-3], then, interchanging rows 1 and 3, and, finally, scaling row 5 by 2. To complete this part, you, should, first, create the required elementary matrices for the corresponding sets of variables (the variables are specific for each function!) and, then, calculate matrix A by using left multiplication of eye(5) by the created elementary matrices in the indicated order % Explain in your diary file a reason why the obtained matrix A is invertible. "Find matrix C, which is the inverse of A, by using command C-inv(A). Output the result. Then, recalculate C by multiplying (in the correct order!) the inverses of the elementary matrices whose product is matrix A. (Please watch for the order of multiplication!) Output the result. Note: You should receive the same matrix C by using two different methods. Exercise 1 (4 points) In this exercise you will create the three types of elementary matrices, analyze their properties, and perform elementary row-operations on matrices by using the elementary matrices. (a) *Write three functions in MATLAB function El-elel (n,ri.j) function E2-ele2 (n,i,j) function E3-ele3 (n,j.k) The functions create elementary nxn matrices that correspond to the elementary row operations, namely, row replacement, row interchanging. and row scaling. You should start with the identity matrix eye(n). Matrix El is obtained from eye(n) by replacing (row/) with [(rowj) + (row i) Matrix E2 is obtained from the matrix eye(n) by interchanging rows i and j. Matrix E3 is obtained from eye(n) by multiplying row j by k Type the functions in your diary file type elel type ele2 type ele3 Part I *Run each of the three created function forn 4 r3; i2, j-4; k-5; Your outputs must be three matrices El, E2, E3 for the indicated variables and you will be working with them in this part of the Exercise. %Write a comment how each of these matrices was generated from the matrix eye(4). Calculate the determinant of cach of the elementary matrices E1, E2, E3 det(El), det(E2), and det(E3). Output them. % Comment within your diary file whether the determinants, which you have calculated, are different form the determinant of the original identity matrix and what is the difference. *Type the matrix M=magic(4) in your diary file Left multiply matrix M by each of the output matrices El, E2, E3 (one at a time). Output the three products. % Comment on how matrix M has been modified after performing each multiplication. Part II Within your diary file, create a matrix A by starting with eye(5) and performing the following sequence of elementary row-operations: first, replacing (row 2) with [(row 2)+ row 4)-3], then, interchanging rows 1 and 3, and, finally, scaling row 5 by 2. To complete this part, you, should, first, create the required elementary matrices for the corresponding sets of variables (the variables are specific for each function!) and, then, calculate matrix A by using left multiplication of eye(5) by the created elementary matrices in the indicated order % Explain in your diary file a reason why the obtained matrix A is invertible. "Find matrix C, which is the inverse of A, by using command C-inv(A). Output the result. Then, recalculate C by multiplying (in the correct order!) the inverses of the elementary matrices whose product is matrix A. (Please watch for the order of multiplication!) Output the result. Note: You should receive the same matrix C by using two different methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
