Lu decomposition help needed

1 view (last 30 days)
dulanga
dulanga on 21 Mar 2019
this is as far as i have got can anyone help me?
function [L,U] = LUdecomp(A)
n = size(A,1); %number of rows
m = size(A,2); %number of cols
% Check to see if the input matrix is a square
if n~=m
error('The input matrix is not square')
end
U = A; %The U matrix will be what is left after G.E. with the matrix A
L = eye(n); %The L matrix will be what is left after G.E. applied to the identity matrix
for i = 1:n-1 %i is the current column that you are trying to create zeros for in U
for j = i+1:n %j is the current row that you are trying to create the zero in

Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!