【问题标题】:Weird behavior of a sparse Matrix under MATLABMATLAB下稀疏矩阵的奇怪行为
【发布时间】:2013-07-23 09:00:58
【问题描述】:

我在 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 没有任何 nans。矩阵大小为 63521 x 63521

【问题讨论】:

  • 你也检查过isinf吗?
  • 你找到63521-bus电源系统了吗??

标签: matlab matrix sparse-matrix


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2017-07-07
    • 2017-07-02
    • 1970-01-01
    • 2013-04-11
    • 1970-01-01
    • 2012-06-20
    • 2014-05-12
    • 1970-01-01
    • 2022-08-18
    相关资源
    最近更新 更多