a = zeros(100,100,100);
distance = [1,21,41,61,81];
for d = 1:5
for i=distance(d): distance(d)+19
for j=distance(d): distance(d)+19
for k=distance(d): distance(d)+19
a(i,j,k) = 1;
end
end
end
end
The tensor a
with size (100,100,100) and all element dominate the diagonal.
How to visulize a
it in MATLAB
with zero is white color and one is black color. I plot in MS office, this is what I want Expected image
For matrix case, we can visualize as follow
X = zeros(100,100);
distance = [1,21,41,61,81];
for d = 1:5
for i=distance(d): distance(d)+19
for j=distance(d): distance(d)+19
X(i,j) = 1;
end
end
end
imagesc(a)
im = imagesc(1-X)
colormap(gray(256))
And the image is 2D matrix visulize
How to do a similar way for tensor?