MATLAB 矩阵符号之间的差异
您如何阅读以下 MATLAB 代码?
#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
哪里
A =
2 1
1 1
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在第二种情况下
p,d=eig(A)
MATLAB只是打印之前在情况 1 中计算出的 p 值,然后运行命令d=eig(A)
。在运行案例 2 之前尝试
如果然后运行
p,d=eig(A)
它将返回一个错误,指出 p 是未定义的函数或变量。来自
help eig
:请注意,没有
V,D = EIG(X)
选项。返回多个值的 MATLAB 函数将使用以下格式对它们进行分组: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:是一样的
is the same as