Plotting sparsity pattern of a matrix

5 ビュー (過去 30 日間)
Fayas Ahamed
Fayas Ahamed 2019 年 6 月 3 日
コメント済み: Fayas Ahamed 2019 年 6 月 4 日
Hi Guys,
I want to visualize the sparsity pattern of a sparse matrix using the function spy().All elements in this matrix is approximated to 4th digit (example : 0.0031,0.0000). The spy() function does not identify 0.0000 or -0.0000 s as absolute zeros. I mean the pattern seems to be dense. How can I overcome this issue? please help me.

採用された回答

Matt J
Matt J 2019 年 6 月 4 日
spy(abs(yourMatrix)>=0.0001)
  1 件のコメント
Fayas Ahamed
Fayas Ahamed 2019 年 6 月 4 日
Thanks Matt. this works for me.

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2019 年 6 月 4 日
YOu can plot the required sparsity using different colors and markers. This might help.
A = rand(10) ;
figure
hold on
spy(A<0.5,'r')
apy(A>0.5,'b')
  1 件のコメント
Fayas Ahamed
Fayas Ahamed 2019 年 6 月 4 日
Thanks KSSV. This is a good answer.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by