Skip to content
Permalink
2f9ce3f0af
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
21 lines (19 sloc) 381 Bytes
function [ud, uo, lo ] = lu_tridiag( e,f,g )
%create matrixs A and B
A=diag(e,-1)+ diag(f)+diag(g,1);
B=eye(length(f));
for i=1:length(e)
X=A(i+1,i)/A(i,i);
A(i+1,i)= (-e(i)/f(i))*f(i)+e(i);
A(i+1,i+1)= (-X)*g(i)+f(i+1);
B(i+1,i)=X;
ud(1)=A(1,1);
ud(i+1)= A(i+1,i+1);
uo(i)=A(i,i+1);
lo(i)=B(i+1,i);
end
%displays function results
disp(ud)
disp(uo)
disp(lo)
end