浙江工业大学化材学院 jackdong % strings 'F1' 'F2'
% - a and b are the left and right end points
% - alpha=x(a) and beta=x(b) :boundary conditions
% - M is the number of steps
% output - L=[T' x] where T' is the (M+1)*1 vector of ordinates
%solve the system F1
Za=[alpha,0];
[T,Z]=rks4(F1,a,b,Za,M);
U=Z(:,1);
%solve the system F2
Za=[0,1];
[T,Z]=rks4(F2,a,b,Za,M);
V=Z(:,1);
%calculate the solution to the boundary value problem
X=U+(beta-U(M+1)*V)/V(M+1);
L=[T' X];
---------------------------------------------------------------------------------------------------------------------- 3.12. 求解三对方程组的程序
功能:求解三对角方程组CX=B,其中C为三对角矩阵
---------------------------------------------------
function X=trisys(A,D,C,B)
%Input - A is the subdiagnonal of the coefficient matrix
32