?? tdma.m
字號:
function X = TDMA(A,D,C,B)
% Tridiagonal Matrix Algorithm(三對角陣算法)
%
% Function: to solve the Tridiagonal system CX=B, where C is a Tridiagonal matrix
%
% Input - A is the subdiagonal of the coefficient matrix
% - D is the main diagonal of the coefficient matrix
% - C is the superdiagonal of the coefficient matrix
% - B is the constant vector of the linear system
% Output - X is the sulution vector
N = length(B);
for k=2:N
mult = A(k-1)/D(k-1);
D(k) = D(k)-mult*C(k-1);
B(k) = B(k)-mult*B(k-1);
end
X(N) = B(N)/D(N);
for k=N-1:-1:1
X(k) = (B(k)-C(k)*X(k+1))/D(k);
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -