LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpolating Sparse Surface

I have a sparse data set comprised of x,y,z data (see attached vi for an example of the dataset.  I need to be able to interpolate this data on x from 0-360 in integer steps of 1 and on y from the min of the y-column to the max of the y-column in steps of 0.1, populating the z column with the interpolated values.  Once I have fully defined this surface I will need to do a surface plot.  I am having trouble with the interpolation and am curious if anyone has a nice way to do it, or any pointers.  I appreciate any feedback.
0 Kudos
Message 1 of 6
(3,267 Views)
Here is an update, I need to interpolate the 2D array so that all -1 values have been replaced with interpolated Z values.

Message Edited by jmcbee on 12-23-2008 02:35 PM
Download All
0 Kudos
Message 2 of 6
(3,251 Views)
Message Edited by jmcbee on 12-23-2008 03:27 PM
Download All
0 Kudos
Message 3 of 6
(3,238 Views)

If you have a good mathematical model for the shape of the data (e.g. 2D gaussian), you could fit it using Levenberg Marquardt and them generate the rest of the points from the fit paramters.

 

If you need a model-free approach, have a look at the mathschript function "griddata".

 

From the LabVIEW help:

 


Griddata

: Fits a surface to the unevenly distributed sample points that you specify. The resulting fit passes through all the specified sample points
Message Edited by altenbach on 12-23-2008 02:56 PM
Message 4 of 6
(3,231 Views)
Hi Altenbach thank you for the feedback.  I came across an example program using griddata and followed it.  It is working but the results are not what I expect to see.  Perhaps the data I am trying to interpolate is just too sparse.
Download All
0 Kudos
Message 5 of 6
(3,188 Views)

Here's a method I have used before.  It may be similar to the griddata function, but I am not sure.  The results are similar to using a tight skin to represent the surface and pushing or pulling each point to a known value.

 

For each point of known data, define an interpolation kernel.  The kernel should be equal to 1 at that point and eventually go to 0 far away from the point.  It should be smooth.  A 2D gaussian usually works great.  You just need to pick the right dropoff rate.

 

For each point of known data, evaluate all the interpolation kernels.  For that point, the value will be 1 and all other kernels will be less than 1.  Build up the values to get a 2D matrix of coefficients (kernel values) and a 1D array of known values.  Use matrix inversion to get the coefficients for each interpolation kernel.

 

Now you can evaluate any point in space.  Just evaluate all the interpolation kernels and add them up to get the value.

 

This works best when your actual values go to zero at infinity.  Some things you could do to improve your results:  Subtract the average value of all the points, then add that average value back to the interpolated points.  Similarly, find an overall function that is close to your data and do an overall fit.  Subtract the value of this function from each data point, then add it back to the interpolated value at the end.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 6 of 6
(3,133 Views)