Hi,
Legends can be added to all sorts of graph present in MATLAB.
You can have a look at
https://in.mathworks.com/help/matlab/ref/legend.html for more understanding of legends and also have a look at thishttps://in.mathworks.com/help/matlab/ref/mesh.html
%Here is an example from the docs
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(X,Y,Z)
legend({'z axis'})
Alternatively,
you can go through this MATLAB answer to have more idea about it, here the user also wants to add legend but with different surfaces