代码之家  ›  专栏  ›  技术社区  ›  Léo Léopold Hertz 준영

MATLAB的矩阵符号之间的差异

  •  1
  • Léo Léopold Hertz 준영  · 技术社区  · 15 年前

    你如何阅读以下内容 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
    
    2 回复  |  直到 4 年前
        1
  •  18
  •   Peter Mortensen icecrime    15 年前

    在你的第二个案例中 p,d=eig(A) MATLAB 只是打印案例1中先前计算的p值,然后运行命令 d=eig(A) .

    >> clear p d
    

    如果你然后跑 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()
    
        2
  •  3
  •   Nzbuu    15 年前
    p,d=eig(A) 
    

    p
    d=eig(A)