MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   MATLAB矩阵表示法之间的区别 (https://www.labfans.com/bbs/showthread.php?t=22898)

poster 2019-12-10 16:49

MATLAB矩阵表示法之间的区别
 
您如何阅读以下[URL="http://en.wikipedia.org/wiki/MATLAB"]MATLAB[/URL]代码?

[B] #1 [/B]

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 [B] #2 [/B]

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
回答:
在第二种情况下, p,d=eig(A) [URL="http://en.wikipedia.org/wiki/MATLAB"]MATLAB[/URL]仅打印情况1中先前计算的p值,然后运行命令d=eig(A) 。

在运行案例2之前,请尝试

>> clear pd 如果然后运行p,d=eig(A) ,它将返回一个错误,指出p是未定义的函数或变量。

从help eig :

E = EIG(X) is a vector containing the eigenvalues of a square matrix X. [V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that X*V = V*D. 请注意,没有V,D = EIG(X)选项。返回多个值的MATLAB函数将使用以下格式对它们进行分组:

[ ] = function()

[url=https://stackoverflow.com/questions/1728602]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 10:28

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.