How can I create a 4D plot using 4 different Vectors.

조회 수: 7 (최근 30일)
ARUN SHANKAR
ARUN SHANKAR 2014년 4월 4일
답변: Naga 2024년 10월 16일
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

답변 (1개)

Naga
Naga 2024년 10월 16일
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.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by