Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Changing axis numbers on 3D surface plots

Subject: Changing axis numbers on 3D surface plots

From: Ulrik Nash

Date: 1 Jul, 2013 09:45:10

Message: 1 of 4

I have a matrix, which I would like to make a 3D surface plot of.

My problem is that when I use the simple surface command, the axis values contain the row and column indexes, and that is not what I want. I wish to change the axis values to something else, for example, to values contained in a vector.

How do I do that?

Subject: Changing axis numbers on 3D surface plots

From: asif khan

Date: 1 Jul, 2013 09:54:00

Message: 2 of 4

On Monday, July 1, 2013 3:15:10 PM UTC+5:30, Ulrik Nash wrote:
> I have a matrix, which I would like to make a 3D surface plot of.
>
>
>
> My problem is that when I use the simple surface command, the axis values contain the row and column indexes, and that is not what I want. I wish to change the axis values to something else, for example, to values contained in a vector.
>
>
>
> How do I do that?

take the mesh plot... like this

let x be a vector and y be another vector..

first take

>>[X Y] = meshgrid(x,y);

And take Z be the matrix that you want to plot, then next take

>>mesh(X,Y,Z)

Subject: Changing axis numbers on 3D surface plots

From: Ulrik Nash

Date: 1 Jul, 2013 10:12:13

Message: 3 of 4

asif khan <asifkhanmohmd@gmail.com> wrote in message <3d161ac4-d35a-462b-b0f8-540fad7a1b93@googlegroups.com>...
> On Monday, July 1, 2013 3:15:10 PM UTC+5:30, Ulrik Nash wrote:
> > I have a matrix, which I would like to make a 3D surface plot of.
> >
> >
> >
> > My problem is that when I use the simple surface command, the axis values contain the row and column indexes, and that is not what I want. I wish to change the axis values to something else, for example, to values contained in a vector.
> >
> >
> >
> > How do I do that?
>
> take the mesh plot... like this
>
> let x be a vector and y be another vector..
>
> first take
>
> >>[X Y] = meshgrid(x,y);
>
> And take Z be the matrix that you want to plot, then next take
>
> >>mesh(X,Y,Z)

Thank you Asif

Subject: Changing axis numbers on 3D surface plots

From: Steven_Lord

Date: 1 Jul, 2013 14:13:19

Message: 4 of 4



"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message
news:kqrj35$2r6$1@newscl01ah.mathworks.com...
> I have a matrix, which I would like to make a 3D surface plot of.
> My problem is that when I use the simple surface command, the axis values
> contain the row and column indexes, and that is not what I want. I wish to
> change the axis values to something else, for example, to values contained
> in a vector.

If you want to change the actual X and Y coordinates at which the surface is
plotted, use the 3 or 4 input form of SURF instead of the 1 or 2 input form:

http://www.mathworks.com/help/matlab/ref/surf.html

"surf(Z) creates a three-dimensional shaded surface from the z components in
matrix Z, using x = 1:n and y = 1:m, where [m,n] = size(Z).
...
surf(X,Y,Z) uses Z for the color data and surface height. X and Y are
vectors or matrices defining the x and y components of a surface."

If you simply want to change what is displayed, use SET to change the
XTickLabel and/or YTickLabel properties of the axes.

http://www.mathworks.com/help/matlab/ref/axes_props.html#XTickLabel

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us