Page 29 - MATLAB an introduction with applications
P. 29
14 ——— MATLAB: An Introduction with Applications
MATLAB determines both the eigenvalues and eigenvectors for a matrix A.
eig(A): Computes a column vector containing the eigenvalues of A.
[Q, d] = eig(A): Computes a square matrix Q containing the eigenvectors of A as columns and a square matrix
d containing the eigenvlaues (λ) of A on the diagonal. The values of Q and d are such that Q Q is the identity
*
matrix and A*X equals λ times X.
Triangular factorization or lower-upper factorization: Triangular or lower-upper factorization expresses a
square matrix as the product of two triangular matrices—a lower triangular matrix and an upper triangular
matrix. The lu function in MATLAB computes the LU factorization.
[L, U] = lu(A): Computes a permuted lower triangular factor in L and an upper triangular factor in U such that
the product of L and U is equal to A.
QR factorization: The QR factorization method factors a matrix A into the product of an orthonormal matrix
and an upper-triangular matrix. The qr function is used to perform the QR factorization in MATLAB.
[Q, R] = qr(A): Computes the values of Q and R such that A = QR. Q will be an orthonormal matrix, and R will
be an upper triangular matrix..
For a matrix A of size m × n, the size of Q is m × m, and the size of R is m × n.
Singular Value Decomposition (SVD): Singular value decomposition decomposes a matrix A (size m × n) into
a product of three matrix factors.
A = USV
where U and V are orthogonal matrices and S is a diagonal matrix. The size of U is m × m, the size of V is n × n,
and the size of S is m × n. The values on the diagonal matrix S are called singular values. The number of non-
zero singular values is equal to the rank of the matrix.
The SVD factorization can be obtained using the svd function.
[U, S, V] = svd(A): Computes the factorization of A into the product of three matrices, USV, where U and V are
orthogonal matrices and S is a diagonal matrix.
svd(A): Returns the diagonal elements of S, which are the singular values of A.
1.11 ELEMENT-BY-ELEMENT OPERATIONS
Element-by-element operations can only be done with arrays of the same size. Element-by-element multiplication,
division and exponentiation of two vectors or matrices is entered in MATLAB by typing a period in front of
the arithmetic operator. Table 1.18 lists these operations.
Table 1.18 Element-by-element operations
Arithmetic operators
Matrix operators Array operators
+ Addition + Addition
– Subtraction – Subtraction
* Multiplication * Array multiplication
^ Exponentiation ^ Array exponentiation
/ Right division / Array right division
\ Left division \ Array left division
F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09