Plot 4D matrix

7 visualizaciones (últimos 30 días)
emko
emko el 10 de Mzo. de 2016
Comentada: Walter Roberson el 10 de Mzo. de 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

Respuesta aceptada

Walter Roberson
Walter Roberson el 10 de Mzo. de 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 comentarios
emko
emko el 10 de Mzo. de 2016
Can be same done with slice, and how?
Walter Roberson
Walter Roberson el 10 de Mzo. de 2016
No, slice() is for extracting data from 3D arrays, not from 4D arrays.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by