making a contour with specific data points

making a contour with specific data points

Post by David Warr » Sat, 11 Jun 2005 05:31:14


New to matlab.

I am trying to make a contour of some 3D data I have. I have several
longitude lines of data that pass over the same 2 poles. I want to
put them one plot that is 2D with a color contour for the z axis. so
I tried:

[X,Y,Z] = meshgrid(mydatax,mydatay,mydataz);
contour(X,Y,Z);

But I get the error, Contour data must have 2 dimensions.

how do I get the z axis data into the contour?
 
 
 

making a contour with specific data points

Post by tim » Sat, 11 Jun 2005 05:36:58

try using NDGRID....
Tim

 
 
 

making a contour with specific data points

Post by David Warr » Wed, 22 Jun 2005 02:41:47

thanks for your answer tim, but ndgrid did the same thing.

I have a set of data that is an outline of a sphere in cartesain
stest (108 x 3) (with a x, y, and z column)

I need to map them as a sphere or contour so what I need is

stestx (108 x 108)
stesty (108 x 108)
stestz (108 x 108)

But when I use meshgrid or ndgrid

[stestx, stesty, stestz] = ndgrid (stest(1:108,1), stest(1:108,2),
stest(1:108,3));

I get
stestx (108 x 108 x 108)
stesty (108 x 108 x 108)
stestz (108 x 108 x 108)

How do I create 3 interconnected 2D matrices with 3 sets of data?



axis.