Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These are the 3 functions I have created so far: function E1 = ele1(n,r,i,j) E=eye(n); E1 = E; new = E1(j,:)+r*E1(i,:); E1(j,:) = new; end

image text in transcribed

These are the 3 functions I have created so far:

function E1 = ele1(n,r,i,j)

E=eye(n);

E1 = E;

new = E1(j,:)+r*E1(i,:);

E1(j,:) = new;

end

----------------------------------------------------

function E2 = ele2(n,i,j)

E=eye(n);

E2=E;

new = E2(j,:);

E2(j,:) = E2(i,:); E2(i,:) = new

end

-----------------------------------------------------

function E3 = ele3(n,j,k)

E=eye(n);

E3 = E;

new = k*E3(j,:);

E3(j,:) = new;

(a) **Write three functions in MATLAB function El-elel (n,r,i,j) function E2-ele2 (n, 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 j) with [(rowj)+(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 elel type ele2 type ele3 **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= A-' by using two different meth0ds. (a) **Write three functions in MATLAB function El-elel (n,r,i,j) function E2-ele2 (n, 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 j) with [(rowj)+(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 elel type ele2 type ele3 **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= A-' by using two different meth0ds

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions