# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Bug in Interpolate 2D Scattered

I spent a lot of time narrowing down a problem I was having and have come to the conclusion that I believe there is a bug in the Interpolate 2D Scattered VI. Since this VI just implements some matrix code, I suspect the bug is actually in the underlying matrix solver code. On to business.

I have tried several data sets, but I have reduced it to some very simple data as you will find in the attached VI which is a copy of the Scattered 2D interpolation block diagram (with a few modifications). The X and Y have been made to be ramps from 0 to 10 with a length specified on the front panel. The Z values are simply a random input between 0 and 1. If you specify the length (i.e. number of points) as anything other than 208 points, then you will get the right answer (the Z is random value, but the right answer should be something in the range of 0 to 1). However, if you specify exactly 208 points, an incorrect answer is returned (in the hundreds...where it should be between 0 and 1).

I have tested with a range of datasets, and if the number of datapoints equals exactly 208, then the answer will be off by a factor of about 1e3 to 1e4 or so.

Anyone at NI able to comment or anyone else seen this problem? The VI is saved in 2016.

Message 1 of 12
(2,319 Views)

## Re: Bug in Interpolate 2D Scattered

One new tidbit...I opened the block diagram for the Solve Linear Equations.vi, and noticed there was a "relative tolerance" value for the Solve Linear Eqns (General) sub-vi. If I set that to 0 instead of the default of -1, then it gives a reasonable/good value. I don't know enough of course to know how or what this value can be changed to control various outputs. That said, it seems like that is still some kind of bug that needs to be fixed...

Message 2 of 12
(2,301 Views)

## Re: Bug in Interpolate 2D Scattered

The Good News is I can reproduce the behavior you describe.  The Bad News is that I have no idea what the code you posted is supposed to do (that is, an understanding "at a high level" of what is going on).  There are a bunch of functions in there including things that look like RMS, exponentials, etc.  Something is clearly not quite right, but without understanding what is happening, I'm not sure where to look for more clues.

Bob Schor

Message 3 of 12
(2,256 Views)

## Re: Bug in Interpolate 2D Scattered

This was a test VI in an effort to debug the problem...and I realized I made a mistake in my description so I will clarify:

The original intent is to use Interpolate 2D Scattered (1D).vi (found in the interpolation and extrapolation palette) to interpolate irregularly sampled XY data with Z values to produce the new Zi value.

When I noticed the bug, I went digging into this VI to see what could be the issue. This VI is composed of VIs for each interpolation method (nearest, linear, cubic, biharmonic spline). Nearest is useless for this application, linear works, but since my original data has curvature to the surface, that leaves cubic of biharmonic spline. Cubic is not good for this data, and that leaves biharmonic spline (this is background to understand the selection of method). If you look at the inner case structure, in the block diagram of Interpolate 2D Scattered (1D).vi, and select 3 (corresponding to the biharmonic spline selection) it executes Interpolate 2D Scattered_Green Function.vi. It is the block diagram of this vi that I have replicated, with a few minor changes for debugging to incorporate test data. This is the block diagram that exhibits the bug.

In summary, I want(ed) to use Interpolate 2D Scattered (1D).vi to interpolate irregular spaced data. During debug I noticed a sub-vi, Interpolate 2D Scattered_Green Function.vi has the bug and I duplicated the code so I could try to work out the issue. The data I'm feeding in is random, and exhibits the issue as you found. I suspect the issue is related to the matrix solver, but under the hood, it is a DLL which makes it inaccessible for further end user debug.

Does this bring enough context?

Message 4 of 12
(2,254 Views)

## Re: Bug in Interpolate 2D Scattered

I have attached the desired implementation which allows you to dig into the sub-vis in the way I did and described. This exhibits the identical error.

Message 5 of 12
(2,252 Views)

## Re: Bug in Interpolate 2D Scattered

Sorry for multiple posts but I'm remembering other parts of my debug. If I tunnel down through the subvis as follows:

Interpolate 2D Scattered (1D).vi --> Interpolate 2D Scattered_Green Function.vi --> Solve Linear Equations (single right hand).vi

There is a "relative tolerance" input to Solve Linear Eqs (Gen, single right hand).vi which is hard coded to -1. Looking at the subvi of this one, -1 or 0 changes which solver is used. If I change this constant from -1 to 0, then the dataset size of 208 starts solving with reasonable values.

Most likely all of this seems to point to an NI specific investigation, since it deals with some hard coded settings in typically unused subvis...just looking for more direction on how I might approach this to get the best response from them.

Message 6 of 12
(2,239 Views)
Solution

## Re: Bug in Interpolate 2D Scattered

Hi,

Thanks for reporting this problem. I think this can be a bug in the underlying implementation of linear equation solver in the DLL. I will report a CAR to track this problem.

Message 7 of 12
(2,190 Views)

## Re: Bug in Interpolate 2D Scattered

Thank you very much.

Message 8 of 12
(2,175 Views)

## Re: Bug in Interpolate 2D Scattered

FWIW, I tried your VI and don't see any problem, whatever "length" value I used (LabVIEW 2016 64 bit).

Message 9 of 12
(2,150 Views)

## Re: Bug in Interpolate 2D Scattered

Good call...64bit doesn't exhibit the problem, only 32bit.

Message 10 of 12
(2,117 Views)