How to add x labels, y labels, z label and title to a surface plot

446 vues (au cours des 30 derniers jours)
Hey yall,
I have created a 3D surface plot and I am wondering how can I put labels on the axises? Please help. Below you will find my code.
x = [18 19 20 20 20 20 20 21 21 21 21 35 35 36 37 37 37 37 38 38 38 38 55 55 56 56 56 57 57 57 57 57 58 76 76 76 77 77 77 77 77 77 78 95 95 95 95 96 96 96 97 97 98 98 137 137 138 139 139 139 139 140 140 140 140 178 178 179 179 180 180 180 180 180 181 181 ];
y = [180 0 10 110 120 140 160 30 50 70 90 160 180 110 0 70 90 140 10 30 50 120 140 180 90 120 160 10 30 50 70 110 0 140 160 180 0 30 50 70 90 110 120 120 140 160 180 70 90 110 0 30 10 50 0 10 30 50 70 120 140 90 110 160 180 50 70 30 140 0 10 90 110 120 160 180 ];
z = [9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 ];
xx = linspace(min(x),max(x),20);
yy = linspace(min(y),max(y),20);
[X,Y] = meshgrid(xx,yy);
Z = griddata(x,y,z,X,Y);
surf(X,Y,Z, 'edgecolor', 'none')

Réponse acceptée

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 9 Oct 2019
Modifié(e) : Sulaymon Eshkabilov le 9 Oct 2019
Just simple as:
xlabel('X'), ylabel('Y'), zlabel('Z')
Or you can add some notes
xlabel('xx notes'), ylabel('yy notes'), zlabel('Z notes')
  1 commentaire
Patrick Smith
Patrick Smith le 9 Oct 2019
What about the title? And which line in the code should I put it?

Connectez-vous pour commenter.

Plus de réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 9 Oct 2019
Modifié(e) : Sulaymon Eshkabilov le 9 Oct 2019
title('My plot 3D ....')
all of them can be put at the end of your code.
Good luck.

Community Treasure Hunt

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

Start Hunting!

Translated by