08-18-2006 10:01 AM
08-21-2006 09:00 AM
Hi,
the x and y arrays (vectors) don't have to contain 1,2,3,4,5 etc. They can be setup as value pairs and then the 2D array for Z matches element by element to the elements in the x and y array.
i.e. to plot the Z array
1,2,3
4,5,6
at
x=0.1,0.2,0.6,0.9,
y=0.7,-1.2,3.4,-9.6
would then plot the z array value1 (element 1,1) at position 0.1,0.7 (x,y) etc
I think this is where the issue is coming in - if I read what you're trying to do correctly you're treating the 3D graph as a square sheet, and you don't want the "corners" showing on the data.
Is that it?
If you've snapped out the x,y to a circular subsection then you'll need to cut that section from your data before passing it to the Plot3DSurface function.
Hope that helps.
Sacha Emery
National Instruments (UK)
08-24-2006 06:13 AM
That is what I am trying todo but I am still having problems.
I have attached a test project.
I believe my xdata and ydata arrays are setup correctly now.
In the test project I am trying to display a flat circle at a value of 1 on the z axis.
I believe the problem may be the z value array not being the correct size ?
Any help greatly appreciated.
Thanks
08-29-2006 06:27 AM - edited 08-29-2006 06:27 AM
Hi,
I've just realised - the setup you're using is a surface graph - you need the parametric setup instead to miss out the corners (you can still plot a surface on that, it's just each array row then represents a data set of joined points so you can describe a circle at a particular radius Two rows then equate to a surface since you have two sets of data.
You pass in 3 x 2D arrays to define the surface to avoid the corners that you get with a normal surface plot.
In your case, the x, y and z matrices will be all the same size. The z matrix would be all '1's since you said you want to plot a flat circle.
so you x and y's would make a surface using sin and cosine similar to :
radius = 5.0;
for (x = 0;x<2;x++)
for (y=0;y<360;y++)
{
xData[x][y] = sin(((double)y*PI)/180)*(double)x * radius;
yData[x][y] = cos(((double)y*PI)/180)*(double)x * radius;
zData[x][y] = 1.0;
}
this would generate a central point (referencing 0,0,1 multiple times, and then a outer circle at a particular radius so you get a surface)
Hope that makes sense.
Sacha Emery
National Instruments (UK)
Message Edited by SachaE on 08-29-2006 12:27 PM