Skip to content
Permalink
c625f3cd70
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
19 lines (13 sloc) 329 Bytes
function matX = solve_tridiag(ud,uo,lo,b)
%Define matrices
matX = zeros(length(b),1);
matY = zeros(length(b),1);
matY(1) = b(1);
for i = 2:length(b)
matY(i)= b(i) - lo(i-1)*matY(i-1);
end
matX(length(b)) = matY(length(b))/ud(length(b));
for i = length(ud)-1:-1:1
matX(i) = (matY(i)-uo(i)*matX(i+1))/ud(i);
end
end