M-Files Numerical Methods Library Matlab, Freemat, Octave and Scilab
M-Files Numerical Methods Library Matlab, Freemat, Octave and Scilab
com
M-files Numerical Methods Library
Matlab, Freemat, Octave and Scilab
Module
LUfbsub_tests.m LUfbsub_tests.sci
Title
Tests on LUfbsub.m LUfbsub.sci that carry out forward and back
substitution for real or complex systems.
Description
This file contains several test problems that demonstrate the m-file
LUfbsub.m and LUfbsub.sci that carries out the forward and back
substitution to solve problems of the form
L U x = P b (1)
to find the solution vector x, where L is a lower-triangular matrix, U
is an upper triangular matrix and P is a permutation matrix, b is a
known vector and x is the vector that is sought.
The matrices L, U and P normally arise as the result of an LU
factorisation of a matrix A; A=LU. If this is the case then the
solution of the equation above is also the solution of
A x = P b. (2)
A number of standard test problems of various dimensions which
are also used on the spreadsheet of examples LU.xlsm, and with
A and b real, in which the solution is known are included in thus
set of tests
The solution of an equation like (2) can be solved straightforwardly
in Matlab, Freemat, Octave and Scilab using the command
x = A \ b (3)
Hence comparing the solution of [L,U,P]=lu(A) followed by
x=LUfbsubs(L, U, n, P, b) with (3) also provides a method for
devising test problems. Some of the test problems are based on
this and complex matrices and vectors are included.
Interface
LUfbsub_tests()
www.numerical-methods.com
Web source of
code.
http://www.numerical-methods.com/freematlab/LUfbsub_tests.m
http://www.numerical-methods.com/freematlab/LUfbsub_tests.sci
Web source of
this guide
http://www.numerical-methods.com/mfiles/LUfbsub_tests.htm
Web source of
the algorithm
http://www.numerical-methods.com/lineq/LU Factorisation.htm
Dependent
routines
NONE
Test file
or file being
tested
This file tests the code in the LUfbsub function
http://www.numerical-methods.com/mfiles/LUfbsub.htm
Licence
This is open source; the software may be used and applied within other
systems or re-published as long as its provenance is appropriately
acknowledged.
See the GNU Licence for more information or contact
[email protected]
Similar codes
that may be of
interest
CLUTESTS, www.numerical-
methods.com/fortran/CLUTESTS_FOR.htm , for complex-valued
systems
LUTESTS, www.numerical-methods.com/fortran/LUTESTS_FOR.htm ,
for real-valued systems
LUfbsub.bas, www.numerical-metods.com/Excel_VBA/LU.xlsm
For the method in visual basic / VBA (Excel)
Bibilography
Solution of Linear Systems of Equations (Matlab/Freemat/Scilab/Octave)
Linear Systems and 2x2 Matrices
Tutorials on Matlab/Freemat
Numerical Methods