# linearsolve

Version:

Solves the linear equation a x = b in the unknown x. If no solution exists, MathScript returns an error. If an infinite number of solutions exist, MathScript does not return an error but generates only one solution.

## Syntax

linearsolve(a, b)
c = linearsolve(a, b)
c = linearsolve(a, b, opts)
[c, r] = linearsolve(a, b)
[c, r] = linearsolve(a, b, opts)
Legacy name: linsolve

## a

Real or complex vector or matrix. The number of rows in a must equal the number of rows in b.

## b

Real or complex vector or matrix.

## opts

Property of a. opts is a structure with the following Boolean fields.

Name Description
LT Lower triangular
UT Upper triangular
POSDEF Positive definite

## c

Real or complex vector or matrix.

## r

Rank of a if a is a rectangular matrix. Reciprocal of the condition number if a is a square matrix.

A = [1, 2, 3; 1, 3, 3; -1, -1, 2];
B = [1; 1; 1];
C = linearsolve(A, B)

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices