Tutorial 6 solution

Tutorial 6 solution - Name: ____________________ Hand in...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Name: ____________________ Hand in this sheet before leaving class. ID: _______________________ Use Gaussian elimination to write A = LU, where L is a lower triangular matrix and U is an upper triangular matrix. 2 6 6 2 1 0 0 0 A = L = 1 4 6 1 0.5 1 0 0 R2 → R2 – (0.5)R1 2 3 2 1 1 –3 1 0 R3 → R3 – (1)R1 2 –10 4 1 R4 → R4 – (2)R1 4 2 2 4 2 6 6 2 2 6 6 2 U = 0 1 3 0 0 1 3 0 0 0 5 –1 R3 → R3 – (–3)R2 0 –3 –4 –1 0 0 0 4 R4 → R4 – (–10)R2 0 –10 –10 0 2 6 6 2 0 1 3 0 0 0 5 –1 R4 → R4 – (4)R3 0 0 20 0 2 6 6 2 0 1 3 0 0 0 5 –1 0 0 0 4 Enter A, L, and U in Matlab. Then compute A – LU to check that your work is correct. 0 0 0 0 A – LU = 0 0 0 0 0 0 0 0 0 0 0 0 Record the code you used to solve for x: Use L and U in Matlab to solve Ax = b, where b = [1 2 3 4]T. 3.35 Assuming U and L already entered... X = –1.05 >> b = [1; 2; 3; 4]; 0.85 >> y = L\b; >> x = U\y –2.25 Hand in this sheet before leaving class. 2 5 3 1 4 2 1 3 Name: ____________________ ID: _______________________ WITHOUT USING MATLAB, write the answer you expect Matlab to compute for each operation below. (For those where you cannot compute the answer by hand, state if Matlab will give an error or an answer.) A.*B A * B A + B 8 –3 2 7 6 2 –10 3 18 –2 3 4 A .– B A.^B A^B Error: dot not needed with – as 16 1/3 Error: not a valid matrix Matlab already does this 625 1 operation. operation component‐wise. A/B A\B A.\B Matlab will give answer Matlab will give answer 2 –1/3 equivalent to AB–1. equivalent to A–1B. –2/5 3 B + 4 A’ A./B 8 3 2 5 0.5 –3 2 7 3 1 –2.5 1/3 Check your answers using Matlab. ...
View Full Document

This note was uploaded on 02/23/2010 for the course MATH 2070 taught by Professor Aruliahdhavidhe during the Spring '10 term at UOIT.

Ask a homework question - tutors are online