Skip to content

Commit

Permalink
Update lu_tridiag.m
Browse files Browse the repository at this point in the history
  • Loading branch information
chv14004 committed Mar 28, 2017
1 parent 9aacb79 commit 6b0a8d0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lu_tridiag.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function [ud,uo,lo]=lu_tridiag(e,f,g);
% lu_tridiag calculates the components for LU-decomposition of a tridiagonal matrix
% given its off-diagonal vectors, e (a) and g (b)
Expand All @@ -12,15 +11,15 @@
ud=zeros(m,n);
uo=zeros(m,n);
lo=zeros(m,n);
%ud(1)=f(1);
%lo(1)=0;
%uo=e;
ud(1)=f(1);
lo(1)=0;
uo=e;


%for i=2:n
% lo(i)=g(i)/(ud(i-1));
% ud(i)=f(i)-(lo(i)*e(i-1));
%end
for i=2:n
lo(i)=g(i)/(ud(i-1));
ud(i)=f(i)-(lo(i)*e(i-1));
end



Expand Down

0 comments on commit 6b0a8d0

Please sign in to comment.