I'm new to MatLab and I have a table of a few hundred variables. I know that the smaller variables hold greater significance than the larger variables in that table and want the sparse matrix I graph to illustrate this. Not so much lim approaches 0
but as the lim approaches 1
because I know the most significant values all approach 1. Do I just take the inverse of that matrix?
Asked
Active
Viewed 127 times
0

wsdzbm
- 3,096
- 3
- 25
- 28

jake mckenzie
- 1,246
- 2
- 8
- 9
-
Can you provide more detail, like how you are graphing and what thresh hold is significant, range of values in matrix, etc etc. There are many ways to interpret your request and alter numbers. – Matt Aug 25 '15 at 01:46
-
I'm extracting a table of values from an xml of a project I'm working on and trying to make a visual representation of all the variables being used in the program. The range of values is from -1 to 1000. The variables that are given the value of 1 are being treated as booleans. Most values don't go above 100. I want to represent the variables in a matrix so I can look at the matrix and quickly identify any sharp discrepancies and changes between variable. Because they're originally in XML they're a bit hard to take in and read all at once. – jake mckenzie Aug 25 '15 at 03:21
1 Answers
2
Note that spy
is a way to visualize the sparsity pattern of a matrix, but does not let you visualize the value. For that, imagesc
is a good candidate.
It would help to have more information about the problem, but here is one way you could illustrate the importance of values closer to 1.
% Generate a random 10x10 matrix with 50% sparsity in [0,9]
x = 9*sprand(10,10,0.5);
% Add 1 to non-zero elements so they are in the range [1,10]
x = spfun(@(a) a+1, x);
% Visualize this matrix
figure(1); imagesc(x); colorbar; colormap('gray');
% Create the "importance matrix", which inverts non-zero values.
% The non-zero elements will now be in the range [1/10,1]
y = spfun(@(a) 1./a, x);
% Visualize this matrix
figure(2); imagesc(y); colorbar; colormap('gray');
edit to address comment:
% If you want to see values that are exactly 1, you can use
y = spfun(@(a) a==1, x);
% If you want the inverse distance from 1, use
y = spfun(@(a) 1./(abs(a-1)+1), x);

kmac
- 688
- 4
- 15