LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpolation, Triangle Search Failure

I am using the Interpolate 2D Scattered VI (linear method), contained in the AAL Interpolation library on LabView 2016 to interpolate a lookup table of microwave powers. For most points the interpolation work perfectly, but for some reason, certain interpolation points fail and give [].

 

I have traced the error to the Triangle Search VI, in the AAL Geometry library. This VI looks for a triangle depending on the input data arrays and what you want interpolated. In a successful interpolation, it finds a triangle and outputs its location to the next VI along, but for the unsuccessful interpolation points it does not and therefore returns a value of NaN that carries back to the output where it outputs [].

 

Does anyone know what this VI does within interpolation? Or what might be going on geometrically?

I haven't attached the VIs as mine are complex and the error lies within NIs code. The VI doesn't output an error I can look up annoyingly.

I realise this is probably not enough info to solve the problem but I can't figure out what is going on which makes it hard to fix. I'll continue trying and if I find the solution I'll post the answer but some help would be appreciated.

 

Thanks

0 Kudos
Message 1 of 5
(2,079 Views)

Having data that triggers a failure is almost necessary when trying to "find a possible bug".  You have data that causes a failure, and a function that fails -- write a small Demo program that has the Data saved in a Control with "Make Current Values Default" (so that the data remain when you close the VI) and wire that to your Interpolation routine, verifying to yourself that it always fails, then attach this so we (and NI) can inspect and test it.

 

Bob Schor

0 Kudos
Message 2 of 5
(2,057 Views)

I've attached the VI (LabView 2016) plus the necessary lookup data in a *.csv file (it should be a *.tsv but I can't uplaod that apparently, so you may have to change the extension back to make it work). If you look at it you will need the built in National Instruments AAL Interpolation and Geometry packages too.

The error is happening deep within the interpolation VI:

AAL Interpolation: Interpolate 2D Scattered--->AAL Interpolation: Interpolate 2D Linear---> AAL Geometry: Triangle Search

An unsucessful interpolation does not find a small enough triangle I think. Though why this is I haven't had the time to find out yet.

I have tried the other interpolation methods but they are not suitable for my purpose.

Download All
0 Kudos
Message 3 of 5
(2,030 Views)

One reason we ask that you attach your code (thank you very much) is that we can look at it, read the Help on the functions you use (if necessary), and give (possibly helpful) advice.  Here's what it says about the Linear Method for Interpolate 2D Scattered:

linear (default)—Performs linear interpolation on the selected triangle (non-smooth). This method triangulates the convex hull of (X, Y) and interpolates Zi for the points inside a triangle.

(Xi, Yi) is valid only inside the convex hull of (X, Y). Otherwise, LabVIEW returns NaN.

 

I think I found your problem.

 

Bob Schor

0 Kudos
Message 4 of 5
(2,021 Views)

OK, first of all, you might want to take a step back and really look at the data. Once sorted in x and y, the points form a perfect rectangular grid and the data is very similar in all 50 point segments, but linearly displaced in the other dimension. This should give you sufficient information to come up with a significantly better interpolation scheme. See how far you get...

 

scangrid.png

0 Kudos
Message 5 of 5
(2,014 Views)