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:
surf plot

Subject: surf plot

From: Wendy

Date: 10 Mar, 2010 12:26:04

Message: 1 of 3

Hi all,

I am making a surf plot. However, I found the Z values are plotted on the grid points of the plot. Is there a way that I can make one grid (square) represent a value? For example, I make a surface plot for data
x = 1:3;
y = 1:3;
[X,Y]=meshgrid(x,y);
Z = [2 7 3;
       9 7 5;
       6 4 2];
surf(X,Y,Z)
view(2)

The surf plot would only have two columns of squares. I understand the values are plotted on the vertices and the colours are interpreted from 4 adjacent vertices. Is there a way that I can make the plot consisted of 3 columns, and each represent one column of values? Does anyone know any function does that?

Thank you
Wendy

Subject: surf plot

From: Cokelid

Date: 10 Mar, 2010 16:37:33

Message: 2 of 3

> Is there a way that I can make the plot consisted of 3 columns, and each represent one column of values?

Are you looking for a 3D plot? In your example bar3(Z) might do what
you're after perhaps?

Justin

Subject: surf plot

From: Walter Roberson

Date: 10 Mar, 2010 18:04:00

Message: 3 of 3

Wendy wrote:

> I am making a surf plot. However, I found the Z values are plotted on
> the grid points of the plot. Is there a way that I can make one grid
> (square) represent a value?

That's more towards the 'bar' family of functions, perhaps bar3() ?

Tags for this Thread

No tags are associated with 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