How do you read the following MATLAB codes?
#1
K>> [p,d]=eig(A) // Not sure about the syntax.
p =
0.5257 -0.8507
-0.8507 -0.5257
d = // Why do you get a matrix?
0.3820 0
0 2.6180
#2
K>> p,d=eig(A) // Not sure about the syntax.
p =
0.5257 -0.8507
-0.8507 -0.5257
d = // Why do you get a vector?
0.3820
2.6180
where
A =
2 1
1 1
In your second case
p,d=eig(A)MATLAB is merely printing the previously calculated value of p from case 1 and then running the commandd=eig(A).Before running case 2 try
If you then run
p,d=eig(A)it will return an error saying that p is undefined function or variable.From
help eig:Note there is no
V,D = EIG(X)option. MATLAB functions that return more than one value will group them using the format: