Plotting sparsity pattern of a matrix

조회 수: 4 (최근 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 CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by