LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XYZ Plot Interpolation - Contour and/or Surface

I'm having a really difficult time trying to get some XYZ data to plot smoothly.

 

I have 3 1D arrays of doubles:

             The x-axis is distance forward.

             The y-axis is distance right (negative values indicate left).

             The z-axis is intensity at each point.

 

My X-Y data is not uniformly spaced.

 

I have a LOT of data that I'm mapping (sometimes > 200,000 points).  For this example, I've cut down my data points to just under 10,000.

 

The scatter plot ALMOST gets me what I want, but not quite.  As such, I've been trying to interpolate values between points and map the result using a contour plot and a surface plot..

 

I have attempted a number of ways to interpolate the data without much success.  I attempted to use the 3D polynomial fit and evaluation VI's mentioned in post 8 of this thread:

 

http://forums.ni.com/t5/LabVIEW/How-to-plot-3D-surface-graph-from-X-Y-Z-points/td-p/1193853

 

 

The latest attempt is using the 2D Interpolation vi mentioned in the Labview example:  Scattered 2D Interpolation

 

The surface plot calculates quickly but the resulting graph is basically a solid color and doesn't make sense to me.  The contour graph is a total bust.  LabVIEW runs out of memory and I have to force quit.

 

I've attached a zip file containing the VI I'm using 'Surface Plot testing.vi' along with text files to import X, Y and Z data.

 

I'm attempting to get to something similar to this as my end result.  I'm assuming I should be trying to use a contour plot so I can easily get the contour lines

but so far I've been quite unsuccessful trying to use the contour plot as it seems to choke on the data size a lot faster than the other plots.

Desired Results.png

 

This is what my scatter plot currently looks like:

Scatter Plot.PNG

 

So, I'm looking for a way to efficiently interpolate the missing values and then add the contour lines.  Any suggestions would be GREATLY appreciated.

 

**EDIT** 

Please not that you have to unzip the attached file and run the .VI  so that it can find the data files to import and the LLB file used by the polynomial fit and evaluation VIs.

 

Thanks!

-Randy

0 Kudos
Message 1 of 4
(5,422 Views)

Randy,

 

I would encourage you to look at this forum  http://forums.ni.com/t5/LabVIEW/XYZ-graph/td-p/966311 and see if you can adapt what was discussed here to fit your application. If you cannot could you describe the specific problems you are having so that we can effectively troubleshoot. Thanks.

Matt P.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(5,375 Views)

Dear Randy

 

I have almost the same problem to solve as you have described. I'm wondering whether you could find a way in LabVIEW?

Any hints are very appreciated. Thanks you for your short reply. 

 

Thank you!

Andreas

0 Kudos
Message 3 of 4
(5,289 Views)

Because your dataset fills only part of the space, I would break the problem up:

  1. map the data into a space where it is easier to do the interpolation.
  2. get the interpolation working in this space. 
  3. then go back to a discretized version of the original space (i.e. a matrix/image) and raster scan using your interpolating function.

Below is your data, and then your data mapped into a polar-ish coordinates of log (r) vs theta with origin @ (1.5,0.0) using arctan2. (There is probably a better mapping than log(r) for the radius.) It might still be too much for Interpolate 2D Scattered (it looks for a triangle around your point of interest) but it will have a better chance of doing a decent job if you can give it approximately uniformly-spaced data as input.

 

 

remap.png

 

 

0 Kudos
Message 4 of 4
(5,265 Views)