Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

2/27/23 7:48 PM MATLAB Command Window 1 of 9

>> help exp m


Error using help (line 47)
Help only supports searching for one topic

Use the Help browser search field to search the documentation.

>> help exp m


Error using help (line 47)
Help only supports searching for one topic

Use the Help browser search field to search the documentation.

>> help eig


eig Eigenvalues and eigenvectors.
E = eig(A) produces a column vector E containing the eigenvalues of
a square matrix A.

[V,D] = eig(A) produces a diagonal matrix D of eigenvalues and


a full matrix V whose columns are the corresponding eigenvectors
so that A*V = V*D.

[V,D,W] = eig(A) also produces a full matrix W whose columns are the
corresponding left eigenvectors so that W'*A = D*W'.

[...] = eig(A,'nobalance') performs the computation with balancing


disabled, which sometimes gives more accurate results for certain
problems with unusual scaling. If A is symmetric, eig(A,'nobalance')
is ignored since A is already balanced.

[...] = eig(A,'balance') is the same as eig(A).

E = eig(A,B) produces a column vector E containing the generalized


eigenvalues of square matrices A and B.

[V,D] = eig(A,B) produces a diagonal matrix D of generalized


eigenvalues and a full matrix V whose columns are the corresponding
eigenvectors so that A*V = B*V*D.

[V,D,W] = eig(A,B) also produces a full matrix W whose columns are the
corresponding left eigenvectors so that W'*A = D*W'*B.

[...] = eig(A,B,'chol') is the same as eig(A,B) for symmetric A and


symmetric positive definite B. It computes the generalized eigenvalues
of A and B using the Cholesky factorization of B.

[...] = eig(A,B,'qz') ignores the symmetry of A and B and uses the QZ


algorithm. In general, the two algorithms return the same result,
however using the QZ algorithm may be more stable for certain problems.
The flag is ignored when A or B are not symmetric.

[...] = eig(...,'vector') returns eigenvalues in a column vector


instead of a diagonal matrix.
2/27/23 7:48 PM MATLAB Command Window 2 of 9

[...] = eig(...,'matrix') returns eigenvalues in a diagonal matrix


instead of a column vector.

See also condeig, eigs, ordeig.

Documentation for eig


Other functions named eig

>> help exp


exp Exponential.
exp(X) is the exponential of the elements of X, e to the X.
For complex Z=X+i*Y, exp(Z) = exp(X)*(COS(Y)+i*SIN(Y)).

See also expm1, log, log10, expm, expint.

Documentation for exp


Other functions named exp

--- help for expm ---

expm Matrix exponential.


expm(A) is the matrix exponential of A and is computed using
a scaling and squaring algorithm with a Pade approximation.

Although it is not computed this way, if A has a full set


of eigenvectors V with corresponding eigenvalues D then
[V,D] = EIG(A) and expm(A) = V*diag(exp(diag(D)))/V.

EXP(A) computes the exponential of A element-by-element.

See also logm, sqrtm, funm.

Documentation for expm


Other functions named expm

>> A = [1 2 3 ; 4 5 6 ; 7 8 9 ]

A =

1 2 3
4 5 6
7 8 9

>> exp A
Check for incorrect argument data type or missing argument in call to function
'exp'.

>> exp (A)

ans =

1.0e+03 *
2/27/23 7:48 PM MATLAB Command Window 3 of 9

0.0027 0.0074 0.0201


0.0546 0.1484 0.4034
1.0966 2.9810 8.1031

>> expm (A)

ans =

1.0e+06 *

1.1189 1.3748 1.6307


2.5339 3.1134 3.6929
3.9489 4.8520 5.7552

>> eig(A)

ans =

16.1168
-1.1168
-0.0000

>> VP=eig(A)

VP =

16.1168
-1.1168
-0.0000

>> [V1,V2]=eig (A)

V1 =

-0.2320 -0.7858 0.4082


-0.5253 -0.0868 -0.8165
-0.8187 0.6123 0.4082

V2 =

16.1168 0 0
0 -1.1168 0
0 0 -0.0000

>> m=V1

m =

-0.2320 -0.7858 0.4082


-0.5253 -0.0868 -0.8165
-0.8187 0.6123 0.4082
2/27/23 7:48 PM MATLAB Command Window 4 of 9

>> Ad=(1/m)*A*m
Error using /
Matrix dimensions must agree.

>> Ad=m^-1*A*m

Ad =

16.1168 0.0000 0.0000


-0.0000 -1.1168 -0.0000
0.0000 0.0000 0.0000

>> b=exp (Ad)

b =

1.0e+06 *

9.9875 0.0000 0.0000


0.0000 0.0000 0.0000
0.0000 0.0000 0.0000

>> c=expm (Ad)

c =

1.0e+06 *

9.9875 0.0000 0.0000


-0.0000 0.0000 -0.0000
0.0000 0.0000 0.0000

>> Ae=m*Ad*m^-1

Ae =

1.0000 2.0000 3.0000


4.0000 5.0000 6.0000
7.0000 8.0000 9.0000

>> Aa=m*Ad*m^-1

Aa =

1.0000 2.0000 3.0000


4.0000 5.0000 6.0000
7.0000 8.0000 9.0000

>> Ae=m^-1*Ad*m

Ae =

1.4574 6.0591 -3.7188


2/27/23 7:48 PM MATLAB Command Window 5 of 9

3.2855 11.6010 -6.2665


-2.0053 -5.2496 1.9416

>> eig(Ae)

ans =

16.1168
-0.0000
-1.1168

>> eig(exp(A))

ans =

1.0e+03 *

8.2542
0.0000
0.0000

>> eig(exp(Ae))

ans =

1.0e+05 *

1.0921
0.0000
0.0001

>> eig(Ad)

ans =

16.1168
0
-1.1168

>> eig(Aa)

ans =

16.1168
-1.1168
-0.0000

>> eig(Ae)

ans =

16.1168
-0.0000
2/27/23 7:48 PM MATLAB Command Window 6 of 9

-1.1168

>> T=random(3)
'random' requires Statistics and Machine Learning Toolbox.

>> T=random(3)
'random' requires Statistics and Machine Learning Toolbox.

>> T=rand(3)

T =

0.8147 0.9134 0.2785


0.9058 0.6324 0.5469
0.1270 0.0975 0.9575

>> A2=T^-1*A*T

A2 =

3.7130 3.3233 3.4465


-4.4966 -4.1813 -3.1434
14.6833 12.8628 15.4683

>> eig (A2)

ans =

16.1168
-0.0000
-1.1168

>> det (A)

ans =

-9.5162e-16

>> ctrb(a)
Unrecognized function or variable 'a'.

Did you mean:


>> ctrb(A)
Error using ctrb (line 22)
Not enough input arguments.

>> B= [1 2 3]

B =

1 2 3

>> B= [1 ;2 ;3]
2/27/23 7:48 PM MATLAB Command Window 7 of 9

B =

1
2
3

>> Q=[B A*B A*A*B]

Q =

1 14 228
2 32 516
3 50 804

>> det(Q)

ans =

-1.0658e-14

>> rang Q
Unrecognized function or variable 'rang'.

Did you mean:


>> rng Q
Error using rng (line 130)
First input must be a nonnegative integer seed less than 2^32, 'shuffle',
'default', or generator
settings captured previously using S = RNG.

>> rand Q
Error using rand
CLASSNAME input must be a class that supports RAND, for example, 'single' or
'double'.

>> rank Q
Error using svd
First input must be single or double.

Error in rank (line 14)


s = svd(A);

>> rang (Q)


Unrecognized function or variable 'rang'.

Did you mean:


>> rng (Q)
Error using rng (line 133)
First input must be a nonnegative integer seed less than 2^32, 'shuffle',
'default', or generator
settings captured previously using S = RNG.
2/27/23 7:48 PM MATLAB Command Window 8 of 9

>> rank (Q)

ans =

>> rank (A)

ans =

>> b=[1 0 ;2 1 ;3 3]

b =

1 0
2 1
3 3

>> Q=[b A*b A*A*b]

Q =

1 0 14 11 228 162
2 1 32 23 516 369
3 3 50 35 804 576

>> det(Q)
Error using det
Matrix must be square.

>> Q1=ctrb(A,B)

Q1 =

1 14 228
2 32 516
3 50 804

>> Q1=ctrb(A;B)
Q1=ctrb(A;B)

Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check
for mismatched delimiters.

>> Q1=ctrb(A,B)

Q1 =

1 14 228
2 32 516
2/27/23 7:48 PM MATLAB Command Window 9 of 9

3 50 804

>> Q1=ctrb(A,b)

Q1 =

1 0 14 11 228 162
2 1 32 23 516 369
3 3 50 35 804 576

>> c=eye(3)

c =

1 0 0
0 1 0
0 0 1

>> obsv(A,c)

ans =

1 0 0
0 1 0
0 0 1
1 2 3
4 5 6
7 8 9
30 36 42
66 81 96
102 126 150

>> S=[c A*c A*A*c]

S =

1 0 0 1 2 3 30 36 42
0 1 0 4 5 6 66 81 96
0 0 1 7 8 9 102 126 150

>> trace (A)

ans =

15

>> det (S)


Error using det
Matrix must be square.

>>

You might also like