Plot 4D matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
emko
le 10 Mar 2016
Commenté : Walter Roberson
le 10 Mar 2016
Hey all, I am trying to plot this matrix... any ideas how to do this???
x1=linspace(8000,12000,10); % vEa
z1=linspace(0.15,0.25,10); % vva
y1=linspace(1000,3000,10); % vEc
c1=linspace(0.15,0.25,10); % vvc
[X1,Y1,Z1]=meshgrid(x1, y1, z1);
for i=1:length(x1)
for j=1:length(y1)
for k=1:length(z1)
for l=1:length(c1)
f(i,j,k,l)= this is some Cost function which depends on this x1,y1,z1,c1 !!!
end
end
end
end
0 commentaires
Réponse acceptée
Walter Roberson
le 10 Mar 2016
Your
[X1,Y1,Z1]=meshgrid(x1, y1, z1);
is not being used. If you could vectorize your cost function you would need to use
[X1,Y1,Z1,C1] = ndgrid(x1, y1, z1, c1);
Anyhow...
With 4 input dimensions and 1 result, you are dealing with plotting 5 dimensional points. There is no good way of doing that.
About the closest you can get is to scatter3() on 3 of the dimensions, with 1 of the dimensions used for point size and the remaining dimension used for color. In order for that to show up, you will need to use f as one of the spatial coordinates, such as
X1v = X1(:);
Y1v = Y1(:);
Z1v = Z1(:);
C1v = C1(:);
fv = f(:);
scatter3(fv, Y1v, Z1v, X1v, C1v)
it probably will not look all that good.
3 commentaires
Walter Roberson
le 10 Mar 2016
No, slice() is for extracting data from 3D arrays, not from 4D arrays.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!