sparse matrix - Greater weight to smaller values using `spy` in Matlab? -
i'm new matlab , have table of few hundred variables. know smaller variables hold greater significance larger variables in table , want sparse matrix graph illustrate this. not lim approaches 0
lim approaches 1
because know significant values approach 1. take inverse of matrix?
note spy
way visualize sparsity pattern of matrix, not let visualize value. that, imagesc
candidate.
it have more information problem, here 1 way illustrate importance of values closer 1.
% generate random 10x10 matrix 50% sparsity in [0,9] x = 9*sprand(10,10,0.5); % add 1 non-zero elements in range [1,10] x = spfun(@(a) a+1, x); % visualize matrix figure(1); imagesc(x); colorbar; colormap('gray'); % create "importance matrix", inverts non-zero values. % non-zero elements in range [1/10,1] y = spfun(@(a) 1./a, x); % visualize matrix figure(2); imagesc(y); colorbar; colormap('gray');
edit address comment:
% if want see values 1, can use y = spfun(@(a) a==1, x); % if want inverse distance 1, use y = spfun(@(a) 1./(abs(a-1)+1), x);
Comments
Post a Comment