Skip to content
Permalink
master
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
function [x] = solve_tridiag(u,d,b)
% provides solution of Ax=b
% d = diagonal of upper matrix of cholesky factorization
% u = off-diagonal of upper matrix of cholesky factorization
% b = the vector
x = zeros(1,length(b));
y = zeros(1,length(b));
y(1) = b(1)/d(1);
for i=2:length(b)
y(i)=(b(i)-u(i-1)*y(i-1))/d(i);
end
x(length(b)) = y(length(b))/d(length(b));
for i = n-1:-1:1
x(i) = ((y(i)-u(i))*x(i+1))/d(i);
end
end