Main Content

eig

Eigenvalues and eigenvectors of symbolic matrix

Description

example

lambda= eig(A)returns a symbolic vector containing the eigenvalues of the square symbolic matrixA.

example

[V,D] = eig(A)returns matricesVandD. The columns ofV现在eigenvectors ofA. The diagonal matrixDcontains eigenvalues. If the resultingVhas the same size asA, then the matrixAhas a full set of linearly independent eigenvectors that satisfyA*V = V*D.

[V,D,P] = eig(A)returns a vector of indicesP. The length ofPis equal to the number of linearly independent eigenvectors, so thatA*V = V*D(P,P).

example

lambda= eig(B)returns numeric eigenvalues of the square variable-precision matrixB. To convert a symbolic matrixAto variable-precision, useB = vpa(A).

[V,D] = eig(B)also returns numeric eigenvectors.

Examples

collapse all

Compute eigenvalues for the magic square of order 5.

A = sym(magic(5)); lambda = eig(A)
lambda =

( 65 625 2 - 5 3145 2 5 3145 2 + 625 2 - 625 2 - 5 3145 2 - 5 3145 2 + 625 2 )

Compute numeric eigenvalues for the magic square of order 5 using variable-precision arithmetic.

A = magic(5); lambda = eig(vpa(A))
lambda =

( 65.0 21.276765471473795530626426697974 13.126280930709218802525643085949 - 13.126280930709218802525643085949 - 21.276765471473795530626426697974 )

Create a 5-by-5 symbolic matrix from the magic square of order 6. Compute the eigenvalues of the matrix usingeig.

M = magic(6); A = sym(M(1:5,1:5)); lambda = eig(A)
lambda =

( root ( σ 1 , z , 1 ) root ( σ 1 , z , 2 ) root ( σ 1 , z , 3 ) root ( σ 1 , z , 4 ) root ( σ 1 , z , 5 ) ) where σ 1 = z 5 - 100 z 4 + 134 z 3 + 66537 z 2 - 450198 z - 1294704

Theeig函数无法找到确切的术语的特征值s of symbolic numbers. Instead, it returns them in terms of therootfunction.

Usevpato numerically approximate the eigenvalues.

lambdaVpa = vpa(lambda)
lambdaVpa =

( - 2.181032364984695108354692701065 9.8395828502812312578803604206392 - 25.131641669799891607267584639192 26.341617610275869035465716505806 91.131473574227486422276200413812 )

Compute the eigenvalues and eigenvectors for one of the MATLAB® test matrices.

A = sym(gallery(5))
A =

( - 9 11 - 21 63 - 252 70 - 69 141 - 421 1684 - 575 575 - 1149 3451 - 13801 3891 - 3891 7782 - 23345 93365 1024 - 1024 2048 - 6144 24572 )

[v,lambda] = eig(A)
v =

( 0 21 256 - 71 128 973 256 1 )

lambda =

( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )

Input Arguments

collapse all

Square matrix, specified as a symbolic matrix.

Square variable-precision matrix, specified as a numeric matrix. To convert a symbolic matrixAto variable-precision, useB = vpa(A).

Output Arguments

collapse all

Eigenvalues, returned as a symbolic column vector or column vector of symbolic numbers.

Right eigenvectors, returned as a square symbolic matrix whose columns are the right eigenvectors ofA.

Eigenvalues, returned as a symbolic diagonal matrix with the eigenvalues ofAon the main diagonal.

Vector of indices, returned as a symbolic row vector whose length is the total number of linearly independent eigenvectors.

Limitations

Matrix computations involving many symbolic variables can be slow. To increase the computational speed, reduce the number of symbolic variables by substituting the given values for some variables.

Version History

Introduced before R2006a

expand all

Behavior changed in R2021b

See Also

|||

Topics