backsub.m
来自「提供一个直接搜索算法程序」· M 代码 · 共 26 行
M
26 行
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 + =
减小字号Ctrl + -
显示快捷键?