using Matlab In Science and Engineering many problems reduce down to a linear sy
ID: 3553787 • Letter: U
Question
using Matlab
In Science and Engineering many problems reduce down to a linear system of equations, Ax = b If A epsilon Rn times n and is non-singular (that is it has an inverse A-1) then it is possible to factorise A into a product of a lower triangular matrix, L, and and upper triangular matrix, U. That is, LU = A This allows the linear system to be broken into two simpler systems which are easy to solve, Ly = b, Ux = y. This is one approach that MATLAB's operator will often perform if you were to solve the system using x = A b. Your task is to implement the factorisation process. Write a program that takes a square matrix A and computes the matrices L and U. You will most likely need to do some research to find out how to do this. Your solution must work for any sized square matrix. You CANNOT any built in MATLAB factorisation functions, just scalar arithmetic and loops. submit your solution in a separate *.m file. Test you solution for the matrix,Explanation / Answer
M = [5 1.2 0.3 -0.6; 1.2 6 -0.4 0.9; 0.3 -0.4 8 1.7; -0.6 0.9 1.7 10];
n = length( M );
L = zeros( n, n );
for i=1:n
L(i, i) = sqrt( M(i, i) - L(i, :)*L(i, :)' );
for j=(i + 1):n
L(j, i) = ( M(j, i) - L(i, :)*L(j, :)' )/L(i, i);
end
end
L
U=L'
U*L
%This type decomposition can be done on symmetric matrices
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.