Documentation 
Factor square matrix into lower and upper triangular components
The LU Factorization block factors a rowpermuted version of the square input matrix A as A_{p} = L*U, where L is a unitlower triangular matrix, U is an upper triangular matrix, and A_{p} contains the rows of A permuted as indicated by the permutation index vector P. The block uses the pivot matrix A_{p} instead of the exact input matrix A because it improves the numerical accuracy of the factorization. You can determine the singularity of the input matrix A by enabling the optional output port S. When A is singular, the block outputs a 1 at port S; when A is nonsingular, it outputs a 0.
To improve efficiency, the output of the LU Factorization block at port LU is a composite matrix containing both the lower triangle elements of L and the upper triangle elements of U. Thus, the output is in a different format than the output of the MATLAB^{®} lu function, which returns L and U as separate matrices. To convert the output from the block's LU port to separate L and U matrices, use the following code:
L = tril(LU,1)+eye(size(LU)); U = triu(LU);
If you compare the results produced by these equations to the actual output of the MATLAB lu function, you may see slightly different values. These differences are due to rounding error, and are expected.
See the lu function reference page in the MATLAB documentation for more information about LU factorizations.
The following diagram shows the data types used within the LU Factorization block for fixedpoint signals.
You can set the product output, accumulator, and output data types in the block dialog as discussed below.
The output of the multiplier is in the product output data type when the input is real. When the input is complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types.
The rowpivoted matrix A_{p} and permutation index vector P computed by the block are shown below for 3by3 input matrix A.
$$A=\left[\begin{array}{ccc}1& 8& 5\\ 9& 1& 2\\ 2& 5& 7\end{array}\right]\text{}P=\left(\begin{array}{ccc}2& 1& 3\end{array}\right)\text{}{A}_{P}=\left[\begin{array}{ccc}9& 1& 2\\ 1& 8& 5\\ 2& 5& 7\end{array}\right]$$
The LU output is a composite matrix whose lower subtriangle forms L and whose upper triangle forms U.
See Factor a Matrix into Upper and Lower Submatrices Using the LU Factorization Block in the DSP System Toolbox™ User's Guide for another example using the LU Factorization block.
The Main pane of the LU Factorization block dialog appears as follows.
Select to output the singularity of the input at port S, which outputs Boolean data type values of 1 or 0. An output of 1 indicates that the current input is singular, and an output of 0 indicates the current input is nonsingular.
The Data Types pane of the LU Factorization block dialog appears as follows.
Select the rounding mode for fixedpoint operations.
Select the overflow mode for fixedpoint operations.
Specify the product output data type. See FixedPoint Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
An expression that evaluates to a valid data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output data type parameter.
See Specify Data Types Using Data Type Assistant for more information.
Specify the accumulator data type. See FixedPoint Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
An expression that evaluates to a valid data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator data type parameter.
See Specify Data Types Using Data Type Assistant for more information.
Specify the output data type. See FixedPoint Data Types for illustrations depicting the use of the output data type in this block. You can set it to:
A rule that inherits a data type, for example, Inherit: Same as input
An expression that evaluates to a valid data type, for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.
See Specify Block Output Data Types for more information.
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify on the block mask.
Golub, G. H., and C. F. Van Loan. Matrix Computations. 3rd ed. Baltimore, MD: Johns Hopkins University Press, 1996.
Port  Supported Data Types 

A 

LU 

P 

S 

Autocorrelation LPC  DSP System Toolbox 
Cholesky Factorization  DSP System Toolbox 
LDL Factorization  DSP System Toolbox 
LU Inverse  DSP System Toolbox 
LU Solver  DSP System Toolbox 
Permute Matrix  DSP System Toolbox 
QR Factorization  DSP System Toolbox 
lu  MATLAB 
See Matrix Factorizations for related information.