3D imagesc function

43 vues (au cours des 30 derniers jours)
Igor Dal Bo
Igor Dal Bo le 20 Déc 2016
Modifié(e) : KSSV le 20 Déc 2016
Hey all,
I have matrix MxN where every cell is a value of amplitude. What I usually do is plotting this matrix as an image with
imagesc(M,N,matrix)
What I want to do now is the same in 3D, using a set of coordinates (x,y) or (x,y,z). Do you have any suggestion? I have been looking for something with the same result of imagesc(), but I was not able.
Thanks, Igor

Réponse acceptée

KSSV
KSSV le 20 Déc 2016
Modifié(e) : KSSV le 20 Déc 2016
[X,Y,Z] = peaks(25);
x = X(1,:) ;
y = Y(:,1) ;
figure(1)
imagesc('XData',x,'YData',y,'CData',Z)
figure(2)
surf(X,Y,Z) ;
view(2)
shading flat
When X, Y data not available and you plot w.r.t indices
Z = peaks(25);
x = 1:size(Z,1) ;
y = 1:size(Z,2) ;
figure(1)
imagesc('XData',x,'YData',y,'CData',Z)
figure(2)
surf(x,y,Z) ;
view(2)
shading flat

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by