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 [d,u]=chol_tridiag(e,f);
% chol_tridiag is a function that takes 2 vectors as inputs and calculates
%the Cholseky factorization of a tridiagonal matrix
% given e, the off-diagonal vector
% and f, the diagonal vector
% output = [d,u]
% d is the diagonal of the Upper matrix
% u isthe off-diagonal of the Upper matrix
d = zeros(length(f),1);
u = zeros(length(f)-1,1);
d(1) = sqrt(f(1));
u(1) = e(1)/d(1);
l = 2;
while l <= length(f)-1
d(l) = sqrt(f(l)- (u(l-1))^2);
u(l) = e(l)/d(l);
l = l+1;
end
d(4) = sqrt(f(4)-(u(3))^2);
end