📄 testgauss.m
字号:
%% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -