LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot 3D surface and contour graph using four 1D arrays in Labview

I have four 1D arrays which give my X, Y, Z and amplitude data from my Network Analyzer. I want to draw a surface and contour plot using the four arrays where X,Y and Z will be my coordinates and amplitude will be my intensity. I tried to use the data and feed it to 3D surface block of Labview, but I am not able to feed Z data because it requires a matrix and I do not know how to feed my amplitude data to that block. 

 

So I customized a 3D graph using Active X controls to accept four vectors x,y,z and w. The problem I now face is that my points are visible on the graph but I am not able to draw surface and contour on my plot.

 

 

Kindly let know if anyone has faced such a issue or if the same can be plotted using standard LABVIEW blocks like 3D contour/surface. I tried reading examples from Labview on the same but was not able to correlate them with my problem

 

Thanks for your reply.

Download All
0 Kudos
Message 1 of 9
(4,134 Views)

Have a look at my post over here.

 

The Z matrix can be created by reshaping arrays:

 

x is m elements long

y is n elements long

z should be m * n elements

 

If x is [ x0 x1 x2 ] and y is [ y0 y1 y2 ], you need to provide a matrix of:

 

z(x0, y0), z(x0,y1), z(x0,y2)

z(x1, y0), z(x1,y1), z(x1,y2)

z(x2, y0), z(x2,y1), z(x2,y2)

 

So if your z vector is m*n elements long, you need to use Reshape Array to create a 2D array of m rows and n columns.

 

The same goes for your amplitude data.

---
CLA
Message 2 of 9
(4,099 Views)

Thank you very much for the reply. I shall try your approach and come back to you at the earliest.

0 Kudos
Message 3 of 9
(4,086 Views)

I have 'x','y' and 'z' measurements which I want to set as 3 axis of the 3D chart. The intensity will be 4th axis.

The problem I face now is, I have 1D 'Z' vector. How do it form a 2D Z matrix with values of X and Y??

 

Thank you

 

 

0 Kudos
Message 4 of 9
(4,079 Views)

@thoult wrote:

Have a look at my post over here.


Thanks thoult for this tip, very cool!

 

Attached is a vi which shows how to plot ungridded data. I used thoults tip to change the color based on radius and added contour lines...

 

Keep coding!

Download All
0 Kudos
Message 5 of 9
(4,063 Views)

Hi Jessie,

 

This describes adding a color map to a 3D surface and even specifically mentions intensity:

http://digital.ni.com/public.nsf/allkb/E09EB9C864A320CD862568890005B388

 

Note there's an image attached that shows a sample setup.  I hope this helps.

 

John M.
0 Kudos
Message 6 of 9
(4,013 Views)

My plot is showing all data points in scatter mode with their intensities indicated by the colour. Is it possible to draw a surface and contour lines across the scattered points??

 

Thank you

0 Kudos
Message 7 of 9
(3,997 Views)

That's a nice 14 year old document there, John! I wouldn't recommend it to anyone though, as the invoke node methods are superseded by the helper VIs that LabVIEW automatically drops. If a KB doesn't already exist for the latest updates (haven't checked), I would strongly recommend getting one created that's up to date.

 

Liverpool@1892: if you check Gabe's example, he's added contours in to the Surface Graph. If you right click on the indicator and head to 3D Graph Properties, you can mess around with the surface and contour settings there. Alternatively, download Gabe's VI, right click on the control and have a fish around to see what he's done.

---
CLA
0 Kudos
Message 8 of 9
(3,990 Views)

Hi,

   I don't believe there is anyway to automatically mesh scattered data. The 3D plots ultimately need polygons, usually triangles, in order to draw a surface. If your data is essentially a height map where the surface your thinking of drawing does not fold back on itself, but your independent coordinates are not on a Cartesian grid, for instance they are on a polar grid, then you can use the 2D interpolation function to remap your data to a grid which the 3D plot will auto-mesh (that's the example I posted). You may be able to triangulate your data yourself and feed it to the 3D mesh plot, but I haven't tried it. After reading thoult's post and playing around a bit, clearly the 3D surface graph and parametric plot support many more options than any of the other 3D plots. My understanding is the surface graph and parametric plot are based on a 3D picture and the rest are Opengl or a software derivative. The parametric plot is another option but then you need to break your scattered triplets into lines of points with equal numbers of points per line which is a bit more complicated but can create surfaces that fold back on themselves.

 

Good luck!

0 Kudos
Message 9 of 9
(3,977 Views)