hello all
I want to save the Thomas algorithm and backward substitution algorithm and call it whenver I need it in my code. How to do this?
solving linear system with Thomas algorithm******************************* for k = 1:p-1i = k +1;l(i,k)=Ac(i,k)/Ac(k,k);for j = k :k+1Ac(i,j) = Ac(i,j)- l(i,k)*Ac(k,j);endb(i) = b(i)-l(i,k)*b(k); end %apply backward substitution
for k = p:-1:1g(k)=b(k);for j=k+1: min(p,k+1) g(k)=g(k)-Ac(k,j)*g(j);endg(k)=g(k)/Ac(k,k);endT_cn(2:n-1)=g(1:p); end
Best Answer