The x-axis and y-axis are interchanged in the figure by running the following matlab function I wrote.(adsbygoogle = window.adsbygoogle || []).push({});

Could anyone help me to get it corrected? Thanks in advance for any helpful answer.

function axislabeling(n)

x=1:1:n;

y=1:1:n;

z=zeros(n,n);

for i=1:n

for j=1:n

z(i,j)=i;

end

end

surf(x,y,z(x,y))

ylabel('y-axis')

xlabel('x-axis')

zlabel('z-axis')

colorbar

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A question on axis labeling

**Physics Forums | Science Articles, Homework Help, Discussion**