testgauss.m

来自「LU decomposition routines in matlab」· M 代码 · 共 65 行

M
65
字号
%% testgauss.m%%% Use the Gaussian elimination and LU decomposition % to solve a linear system.% The Gaussian elimination is computed by gauss.m,% the upper triangular system is solved by utriangsl.m  %A = [ 2 4 2      4 6 8      1 3 2 ];b = [  4      12        3 ];disp( ' The system matrix A  ')disp( A )disp( ' and the right hand side vector b ')disp( b )disp( ' The solution of A x = b computed using Matlab  A\b')disp( A\b )[A,b] = gauss( A, b);disp( ' The transformed system matrix A  ')disp( A )disp( ' and the transformed right hand side vector b ')disp( b )[b,iflag] = utriangsl( A, b);disp( ' The solution of A x = b ')disp( b )disp( ' Hit return to continue ... ')pausen = 4;A = ones(n,n);A(:,2) = (1:n)';for j = 3:n    A(:,j) = A(:,j-1) .* A(:,2);endb = (1:n)';[A,b] = gauss( A, b)[b,iflag] = utriangsl( A, b);disp( ' The solution of A x = b ')disp( b )

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?