How can I create a 4D plot using 4 different Vectors.
7 views (last 30 days)
Show older comments
Hey guys,
My problem is plotting 4 different vectors ( each having 7000 samples). I have tried using plot3, but it does not provide me the required results.
clc; clear; load Sign1.mat; sign=Sign1';
t=sign(1:7000,1);
xy=sign(1:7000,2:3);
z=sign(1:7000,4); figure; plot(t,z); figure; plot3(t,xy,z); rotate3d on;
Here, Sign1.mat is a file which contains all the four vectors in the form of a matrix (7000*4). The objective is to view these vectors in 4D ( like a 4D figure).
I would appreciate it if anyone could help me with this problem.
I would be exceedingly obliged.
Thanks Arun
0 Comments
Answers (1)
Naga
on 16 Oct 2024
Hello Arun,
To visualize four-dimensional data in MATLAB, you can use a scatter plot where the color or size of the markers represents the fourth dimension. In MATLAB, you can achieve this using a scatter plot where the color or size of the markers represents the fourth dimension. Here's how you can modify your code to achieve a 4D-like visualization:
load Sign1.mat;
sign = Sign1';
% Extract the vectors
t = sign(1:7000, 1);
x = sign(1:7000, 2);
y = sign(1:7000, 3);
z = sign(1:7000, 4);
% Create a 3D scatter plot with color representing the fourth dimension
figure;
scatter3(t, x, y, 36, z, 'filled');
xlabel('t');
ylabel('x');
zlabel('y');
title('4D Visualization using Color');
colorbar; % Add a color bar to indicate the scale for the fourth dimension
rotate3d on;
This approach will give you a visualization where the fourth dimension is represented by varying colors, providing a pseudo-4D view of your data.
0 Comments
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!