permute matrix dimensions: getting trickier ...
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi gurus,
i have a multidimensional matrix (M) and want to plot every combination of two of its dimensions in a mesh. Here is the solution we came up with for octave toguether with its community:
% generate matrix M
size=11;
for A=(1:size)
for B=(1:size)
for C=(1:size)
for D=(1:size)
for E=(1:size)
M(A, B, C, D, E) = A*B^2 - C*D^3 +10*E;
end
end
end
end
end
% plot all pair combinations of M dimensions
n = ndims(M);
for i = 1:n
for j = (i+1):n
figure( (i-1)*n + j );
clf;
mesh( 1:size , 1:size ,...
permute( M,[i j (1:n)( (1:n)!=i & (1:n)!=j )] )(:,:,1,1,1) );
xlabel('abcde'(i));
ylabel('abcde'(j));
end
end
The command permute does not work in this form on matlab. I could'nt find a way out. Could u help me?
thx...
0 commentaires
Réponses (2)
David Sanchez
le 19 Mar 2014
I am a bit confused by the explanation of what you want. Is it something like this?
% plot all pair combinations of M dimensions
n = ndims(M);
for i = 1:size
for j =1:size
for k=1:size
figure();
clf;
[X,Y] = meshgrid(1:size);
mesh(X, Y ,M(:,:,i,j,k));
end
end
end
0 commentaires
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!