📄 backsub.m
字号:
function X=backsub(A,B)%Input - A is an n x n upper-triangular nonsingular matrix% - B is an n x 1 matrix%Output - X is the solution to the linear system AX = B%Find the dimension of B and initialize X% NUMERICAL METHODS: Matlab Programs% (c) 2004 by John H. Mathews and Kurtis D. Fink% Complementary Software to accompany the textbook:% NUMERICAL METHODS: Using Matlab, Fourth Edition% ISBN: 0-13-065248-2% Prentice-Hall Pub. Inc.% One Lake Street% Upper Saddle River, NJ 07458 n=length(B); X=zeros(n,1); X(n)=B(n)/A(n,n);for k=n-1:-1:1 X(k)=(B(k)-A(k,k+1:n)*X(k+1:n))/A(k,k);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -