image thumbnail
from 5D Data Visualization with Matlab Implementation by Hristo Zhivomirov
An 5D (five dimensions) data visualization using Matlab command “slice”.

five_dim_slice.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%         5D Data Visualization        %   
%       with Matlab Implementation     %
% Author: M.Sc. Eng. Hristo Zhivomirov %
%               04/01/2013             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear, clc, close all

x = -1:0.1:1;       % first dimension data
y = -1:0.1:1;       % second dimension data
z = -1:0.1:1;       % third dimension data
A = -1:0.1:1;       % fourth dimension data
data = abs(x.^2 + y.^2 + z.^2 + A.^2); % write the equation that describes the fifth dimension
maxcolor = max(data); % find the maximum of the data function
mincolor = min(data); % find them minimum of the data function

for A = -1:0.1:1    

[X Y Z] = meshgrid(x, y, z);
data = abs(X.^2 + Y.^2 + Z.^2 + A.^2); % write the equation that describes the fifth dimension

figure(1)
subplot(2, 2, 1)
slice(X, Y, Z, data, 0, 0, 0);
shading interp
xlabel('X')                             % xlabel('Tape your xlabel here')
ylabel('Y')                             % ylabel('Tape your ylabel here')
zlabel('Z')                             % zlabel('Tape your zlabel here')
title(['F(X, Y, Z, A) = (X^2 + Y^2 + Z^2 + A^2), when A = ' num2str(A)]) %title('Tape your title here')
alpha(0.75) 
caxis([mincolor maxcolor])
colorbar

subplot(2, 2, 2)
slice(X, Y, Z, data, [-1 -0.5 0 0.5 1], [], []);
shading interp
xlabel('X')                             % xlabel('Tape your xlabel here')
ylabel('Y')                             % ylabel('Tape your ylabel here')
zlabel('Z')                             % zlabel('Tape your zlabel here')
title(['F(X, Y, Z, A) = (X^2 + Y^2 + Z^2 + A^2), when A = ' num2str(A)]) %title('Tape your title here')
alpha(0.75) 
caxis([mincolor maxcolor])
colorbar
view(-10, 15)

subplot(2, 2, 3)
slice(X, Y, Z, data, [], [-1 -0.5 0 0.5 1], []);
shading interp
xlabel('X')                             % xlabel('Tape your xlabel here')
ylabel('Y')                             % ylabel('Tape your ylabel here')
zlabel('Z')                             % zlabel('Tape your zlabel here')
title(['F(X, Y, Z, A) = (X^2 + Y^2 + Z^2 + A^2), when A = ' num2str(A)]) %title('Tape your title here')
alpha(0.75) 
caxis([mincolor maxcolor])
colorbar
view(80, 15)

subplot(2, 2, 4)
slice(X, Y, Z, data, [], [], [-1 -0.5 0 0.5 1]);
shading interp
xlabel('X')                             % xlabel('Tape your xlabel here')
ylabel('Y')                             % ylabel('Tape your ylabel here')
zlabel('Z')                             % zlabel('Tape your zlabel here')
title(['F(X, Y, Z, A) = (X^2 + Y^2 + Z^2 + A^2), when A = ' num2str(A)]) %title('Tape your title here')
alpha(0.75) 
caxis([mincolor maxcolor])
colorbar
view(-20, 10)

end

Contact us