MAT 343 LAB 3

# MAT 343 LAB 3 - MAT 343 MATLAB Assignment#3 Exercise 1...

• Lab Report
• MhsAliFleri
• 4
• 92% (64) 59 out of 64 people found this document helpful

This preview shows page 1 - 4 out of 4 pages.

MAT 343 MATLAB Assignment #3 % Exercise 1 %Declaring all the matrices as per the exercise >> A = floor(10*rand(4,3)) % generating a random 4x3 matrix A = 8 6 9 9 0 9 1 2 1 9 5 9 >> E1 = eye(4); % generating matrix E1 >> E1([1,3],:) = E1([3,1],:) E1 = 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 >> E2 = eye(4); % generating matrix E2 >> E2(2,2) = 5 E2 = 1 0 0 0 0 5 0 0 0 0 1 0 0 0 0 1 >> E3 = eye(4); % generating matrix E3 >> E3(4,1) = 7 E3 = 1 0 0 0 0 1 0 0 0 0 1 0 7 0 0 1 Subscribe to view the full document.

% Computing the Matrix products % Product of matrix A with E1 >> E1*A ans = 1 2 1 9 0 9 8 6 9 9 5 9 Observations – Clearly by multiplying the matrix A by E1 the rows 3 and 1 are inter changed. This is confirmed by looking at the matrix A before and after the multiplication with matrix E1. % Product of matrix A with E2 E2*A ans = 8 6 9 45 0 45 1 2 1 9 5 9 Observations – Clearly by multiplying the matrix A by E2 the 2 nd row is multiplied by 5. This is confirmed by looking at the second row in the matrix A before and after the multiplication with matrix E1. Earlier the row was [9 0 9] and after the multiplication it is [45 0 45]. % Product of matrix A with E3  Subscribe to view the full document. Unformatted text preview: E3*A ans = 8 6 9 9 0 9 1 2 1 65 47 72 Observations – Clearly by multiplying the matrix A by E3 the Fourth row is replaced with the sum oF Fourth row and 7 times the frst row. % Exercise 2 % Part A % Declaring the input matrix &gt;&gt; A = [1, -2, 3; 2, -6, 5; -1, -4, 0] A = 1 -2 3 2 -6 5-1 -4 0 % Defining matrix E1 &gt;&gt; E1 = eye(3); &gt;&gt; E1(3,1) = 1 E1 = 1 0 0 1 1 0 1 % Defining matrix E2 &gt;&gt; E2 = eye(3); &gt;&gt; E1(2,1) = -2 E2 = 1 0 -2 1 0 0 1 % Defining matrix E3 &gt;&gt; E3 = eye(3); &gt;&gt; E1(2,1) = -2 E3 = 1 0 0 1 0 -3 1 % Computing the product E3*E2*E1*A to give matrix U &gt;&gt; U = E3*E2*E1*A ans = 1 -2 3 0 -2 -1 0 0 6 Clearly, the above matrix is an upper triangular matrix % Part B % Computing the product L = E1-1 *E2-1 *E3-1 to give matrix U &gt;&gt; L = inv(E1)*inv(E2)*inv(E3) L = 1 0 2 1 -1 3 1 Clearly, the matrix L is a lower triangular matrix with diagonal entries as 1 % Verifying the product A = LU &gt;&gt; L*U ans = 1 -2 3 2 -6 5-1 -4 The result above is same as the matrix A....
View Full Document

• Fall '08
• ringhofer
• matlab, Matrices, Characteristic polynomial, Diagonal matrix, Triangular matrix

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern