how to plot 4 dimensional data?

34 vues (au cours des 30 derniers jours)
Mudasir Ahmed
Mudasir Ahmed le 21 Nov 2018
Commenté : Walter Roberson le 27 Déc 2020
Hi
I want to plot my data in 4D map. data matrix is of 5000 by 4. each coloumn represent 1 quantity or variable. sample of data is given below.
z=
[1.000000000000000 1.100000000000000 2.300000000000000 16.000000000000000
1.000000000000000 1.100000000000000 2.400000000000000 16.000000000000000
1.000000000000000 1.100000000000000 2.500000000000000 15.000000000000000
1.000000000000000 1.100000000000000 2.600000000000000 15.000000000000000
1.000000000000000 1.100000000000000 2.700000000000000 15.000000000000000
1.000000000000000 1.100000000000000 3.800000000000000 15.000000000000000
1.000000000000000 1.100000000000000 3.900000000000000 15.000000000000000
1.000000000000000 1.100000000000000 4.000000000000000 15.000000000000000
1.000000000000000 1.100000000000000 4.100000000000000 15.000000000000000
1.000000000000000 1.100000000000000 4.200000000000000 15.000000000000000]
how to effeciently plot the given data in more easy visualiztion way. Please help me i will be highly thankful to you
with best regards
Mudasir.
  4 commentaires
Walter Roberson
Walter Roberson le 21 Nov 2018
Attach your data .
Mudasir Ahmed
Mudasir Ahmed le 22 Nov 2018
I am attaching the data file which is comprisedof a matrix 2000 by 4. it is incomplete data because my iterations are running for continuously last three days and may still run further three days more. So I just copy data to where I get the results till now. The total matrix will be 5000 by 4. Also sir, this is only the one case in which first colunm is constant and remain 1. however, in other cases it also varies as others are varying.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 22 Nov 2018
Provided that you have complete data, then your data forms are regular cuboid
x = unique(data(:,1));
y = unique(data(:,2));
z = unique(data(:,3));
w = permute(reshape(data(:,4), length(z), length(y), []), [3 2 1]);
The data sample you provided is 2000 samples long; 2002 samples would have been required to complete a single cycle, so the sample data as is will not work with the above and would need to be padded first, such as with
data(2001:2002,:) = [1 3.1 9.9 1;1 3.1 10 1];
The marginal coordinates are stored in x, y, z .
The resulting w would be (for the sample data) 1 x 22 x 91.
After that you have the question of how best to plot data that has 3 input dimensions and 1 output dimension.
Typical ways to plot multidimensional data include:
  • isosurface
  • slice
  • volumeViewer
  • vol3d v2 (from File Exchange)
  • projections along different views
  • pointsize = 20; scatter3(data(:,1), data(:,2), data(:,3), pointsize, data(:,4)) -- that is, encoding the resultant dimension as color
In the case of your sample data (as padded) some of these will not work because your x data is singleton. However you can use
surf( y, z, squeeze(w).', 'edgecolor', 'none')
  1 commentaire
Mudasir Ahmed
Mudasir Ahmed le 27 Nov 2018
Thank you so much sir

Connectez-vous pour commenter.

Plus de réponses (2)

madhan ravi
madhan ravi le 21 Nov 2018
Modifié(e) : madhan ravi le 21 Nov 2018
Read about isosurface.

Bartlomiej Mroczek
Bartlomiej Mroczek le 26 Déc 2020
Hello,
Anyone have any idea or experience?
I would like to get a spatial plot for the function f, but it is 4 dimensional.
How can this be done?
Script:
V2 = zeros(21,21); % zero value irrelevant
V4 = zeros(21,21); % zero value irrelevant
V6 = zeros(21,21); % zero value irrelevant
f = @(V1, V2, V3, V4, V5, V6) V1.*(10*V1-10*V2+20*V3-21*V4+30*V5-31*V6) - V2.*(10*V1-11*V2+22*V3-21*V4+30*V5-31*V6);
[V1, V3, V5] = meshgrid(0.9:0.01:1.1, 0.9:0.01:1.1, 0.9:0.01:1.1);
Z = f(V1, V3, V5, V2, V4, V6);
  5 commentaires
Bartlomiej Mroczek
Bartlomiej Mroczek le 26 Déc 2020
actually the file connected, weird thanx
Walter Roberson
Walter Roberson le 27 Déc 2020
You need to delete or rename /Users/bartlomiejmroczek/Documents/MATLAB/grid.m as it is interfering with using MATLAB's grid() function .

Connectez-vous pour commenter.

Tags

Produits


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by