Main Content

QR Solver

Find minimum-norm-residual solution to AX=B

  • QR Solver block

Libraries:
DSP System Toolbox / Math Functions / Matrices and Linear Algebra / Linear System Solvers

Description

The QR Solver block solves the linear system AX=B, which can be overdetermined, underdetermined, or exactly determined. The block applies QR factorization to the matrix A to find the minimum-norm-residual solution to AX=B. For more details, see Algorithms.

Ports

Input

expand all

Specify the system matrix A as a vector or a matrix of size M-by-N matrix. The block treats length-M unoriented vector input as an M-by-1 matrix.

The system is solved by applying QR factorization to the M-by-N matrix A at the A port.

Data Types: single | double
Complex Number Support: Yes

Specify the right-side matrix B of the system equation AX=B as an M-by-L matrix.

When B is a vector, the solution X minimizes the vector 2-norm of the residual (B−AX is the residual). When B is a matrix, the solution X minimizes the matrix Frobenius norm of the residual.

Data Types: single | double
Complex Number Support: Yes

Output

expand all

Minimum-norm-residual solution to AX=B, returned as an N-by-L matrix, X. The block determines X so as to minimize the sum of the squares of the elements of B−AX. The minimum-norm-residual solution is unique for overdetermined and exactly determined linear systems, but it is not unique for underdetermined linear systems. Thus when the QR Solver is applied to an underdetermined system, the output X is chosen such that the number of nonzero entries in X is minimized.

When B is a vector, this solution minimizes the vector 2-norm of the residual (B−AX is the residual). When B is a matrix, this solution minimizes the matrix Frobenius norm of the residual. In this case, the columns of X are the solutions to the L corresponding systems AXk=Bk, where Bk is the kth column of B, and Xk is the kth column of X.

For more information on how the block computes X, see Algorithms.

Data Types: single | double
Complex Number Support: Yes

Parameters

expand all

Specify the type of simulation to run. You can set this parameter to:

  • Interpreted execution –– Simulate model using the MATLAB® interpreter. This option shortens startup time.

  • Code generation –– Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations as long as the model does not change. This option requires additional startup time but provides faster subsequent simulations.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Algorithms

QR factorization factors a column-permuted variant (Ae) of the M-by-N input matrix A as

Ae = QR

where Q is a M-by-min(M,N) unitary matrix, and R is a min(M,N)-by-N upper-triangular matrix.

The factored matrix is substituted for Ae in

AeX = Be

and

QRX = Be

is solved for X by noting that Q−1 = Q* and substituting Y = Q*Be. This requires computing a matrix multiplication for Y and solving a triangular system for X.

RX = Y

Extended Capabilities

Version History

Introduced before R2006a