image thumbnail
from 4D Data Visualization with Matlab Implementation by Hristo Zhivomirov
An 4D (four dimensions) data visualization using Matlab commands “scatter” and “slice”.

four_dim_slice.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%         4D Data Visualization        %   
%       with Matlab Implementation     %
% Author: M.Sc. Eng. Hristo Zhivomirov %
%               02/16/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

[X Y Z] = meshgrid(x, y, z);
data = abs(cos(X) + cos(Y) + cos(Z)); % write the equation that describes the fourth dimension

figure(1)
slice(X, Y, Z, data, 0, 0, 0);
shading interp
%xlabel('Tape your xlabel here')
%ylabel('Tape your ylabel here')
%zlabel('Tape your zlabel here')
%title('Tape your title here')
alpha(0.75) 
colorbar

figure(2)
slice(X, Y, Z, data, [-1 -0.5 0 0.5 1], [], []);
shading interp
%xlabel('Tape your xlabel here')
%ylabel('Tape your ylabel here')
%zlabel('Tape your zlabel here')
%title('Tape your title here')
alpha(0.75) 
colorbar
view(-10, 15)

figure(3)
slice(X, Y, Z, data, [], [-1 -0.5 0 0.5 1], []);
shading interp
%xlabel('Tape your xlabel here')
%ylabel('Tape your ylabel here')
%zlabel('Tape your zlabel here')
%title('Tape your title here')
alpha(0.75) 
colorbar
view(-80, 15)

figure(4)
slice(X, Y, Z, data, [], [], [-1 -0.5 0 0.5 1]);
shading interp
%xlabel('Tape your xlabel here')
%ylabel('Tape your ylabel here')
%zlabel('Tape your zlabel here')
%title('Tape your title here')
alpha(0.75) 
colorbar
view(-20, 10)

Contact us