change x/y/z axis values in surf(X,Y,Z) plot

109 views (last 30 days)
Hello, I want to change the axis limits of a surf plot so that they correspond to actual values and not the dimension of the data matrix. Is it possible? I tried setting xlim (y and z as well) but the graph disappears. I use matlab R2017a. Thank you!

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 20 Jun 2019
Edited: KALYAN ACHARJYA on 20 Jun 2019
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
surf(X,Y,Z)
xlim([0 21]);
ylim([1 10]);
zlim([0 50]);
Chosse the x,y,z range in such a way that plotin the range (within space), otherwise plot may be disappears.

Community Treasure Hunt

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

Start Hunting!