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:
contour figure with three variables

Subject: contour figure with three variables

From: mklcst Costola

Date: 28 Jul, 2009 08:10:38

Message: 1 of 5

Hi everyone,
I have a problem with contour figure with 3 variables (x,y,z)... what
is the right way to plot them with contour?
x= 100 x 50
y= 100 x 50
z= 100 x 50

if I use contour(x,y,z) the errors is:

??? Error using ==> contourf at 42
The size of X must match the size of Z or the number of columns of Z.

Someone could help me?
Thank you very much,
Mike

Subject: contour figure with three variables

From: Riedo

Date: 28 Jul, 2009 08:34:01

Message: 2 of 5

Hy Mike

The problem is, that z must be a matrix when you want to use the command contourf.
You could write (if you change z to a matrix) only contourf(z). If you want specific x- and y-axis, you could use contourf(x,y,z).

> x= 100 x 50
> y= 100 x 50
> z= 100 x 50

I hope this helps. Best regards, Andreas.

Subject: contour figure with three variables

From: mklcst Costola

Date: 28 Jul, 2009 08:44:02

Message: 3 of 5

Thank you very much Riedo.
I tryied this but it gives me this error:

contourf(x,y,z);
??? Error using ==> contourf at 46
Z must be size 2x2 or greater.

with
> > x= 100 x 50
> > y= 100 x 50
> > z= 100 x 50

Subject: contour figure with three variables

From: mklcst Costola

Date: 28 Jul, 2009 08:45:02

Message: 4 of 5

Thank you very much Riedo.
I tryied this but it gives me this error:

contourf(x,y,z);
??? Error using ==> contourf at 46
Z must be size 2x2 or greater.

with
> > x= 100 x 50
> > y= 100 x 50
> > z= 100 x 50

Subject: contour figure with three variables

From: Riedo

Date: 28 Jul, 2009 08:53:01

Message: 5 of 5

Sory, I didn't read your deteila exactly. Sory about it. So here could be the probem (see matlab help):

"contourf(X,Y,Z), contourf(X,Y,Z,n), and contourf(X,Y,Z,v) draw filled contour plots of Z using X and Y to determine the x- and y-axis limits. When X and Y are matrices, they must be the same size as Z and must be monotonically increasing."

But: Works the command contourf(z)?

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