Question
Homework problem below, using MATLAB. Any help with this would be useful, I am very new to MATLAB and not very sure where to even
Homework problem below, using MATLAB. Any help with this would be useful, I am very new to MATLAB and not very sure where to even start, let alone finish. Any side tips with this problem would also be helpful!
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 E1=ele1
function E2=ele2
function E3=ele3
The functions create elementary 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 E1 is obtained from eye(n) by replacing (row j) with [(row j) + (row i)r].
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 ele1
type ele2
type ele3
Part I
**Run each of the three created function for n=4; r=3; i=2; j=4; k=5;
Your outputs must be three matrices E1, 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 each of the elementary matrices E1, E2, E3:
det(E1), 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=[1 1 1 1; 2 2 2 2; 3 3 3 3; 4 4 4 4] in your diary file.
** Left multiply matrix M by each of the output matrices E1, 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 by using two different methods.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started