0

我在 MATLAB 中得到了这个63521x63521真正的稀疏对称矩阵,出于某种原因,它对于某些命令似乎表现得很奇怪。

我不确定矩阵文件中是否存在“缺陷”,或者我使用 MATLAB 命令的方式是否存在“缺陷”。

考虑以下脚本。我已经指出了每个步骤的输出。

  % Gives sparsity shown as expected, so this works fine
  spy(rYbus) 

  % I want the top 3 singular values of rYbus. But this line Returns empty matrix! Why/
  S = svds(rYbus,3);

     % Set exact answer and rhs and solve the linear system with iterative and direct method
     b_exact       = ones(size(Ybus,1),1); 
     rhs           = rYbus*b_exact      ;  


    % Following line gives Warning: Matrix is singular, close to singular or badly scaled.
    % Results may be inaccurate. RCOND = NaN. 
    % > In Ybustest at 14. 
     b_numerical_1 = rYbus\rhs;  

    % Even for a single GMRES iteration b_numerical_2 is a vector of Nans.  Why?                          
    b_numerical_2 = gmres(rYbus,rhs,[],[],1);  

谁能指出可能出了什么问题?

我已经使用“isnan”函数来验证矩阵 rYbus 没有任何 nan。矩阵大小为 63521 x 63521

4

1 回答 1

1

您是否检查过您的输入稀疏矩阵 rYbus 是否有任何 NaN?如果我没记错的话,svds 可以给你一个空矩阵而不是一个错误。

另一个可能的错误是 rYbus 的大小。它的大小是多少?

于 2013-07-23T00:44:53.443 回答