LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array or 3D array interpolation, need help

Is it possible to interpolate missing 2D or 3D data?   Attached is an X/Y grid example containing depth readings but in this case we are missing information (blank cells) so how can we get Labview to interpolate and fill in the blank areas based on these known values?  Once we get the new and corrected values, we then need to take this new data and display it on a picture graph to show us the new surface profile.  If anyone can help me or send me an example VI that can do this, it would be a big help.  thanks!! 

 

Bill 

0 Kudos
Message 1 of 8
(7,014 Views)

LV 2011 has a new VI called Interpolate 2D Scattered which will do what you want.  There is even an example called "Scattered 2D Interpolation" which shows exactly how to use it.

 

 

0 Kudos
Message 2 of 8
(7,012 Views)

Would it be possible for you to create a VI for me using the example I sent you just so I can see it work and test it?

0 Kudos
Message 3 of 8
(7,006 Views)

Hello Bill,

 

Thank you for bringing your issue to the forums. As discussed above, there are three examples which I think you will find very helpful. When in LabVIEW, go to Help>Find Examples.. Then search "Interpolation," the three examples I would recommend you look at are:

1. Scattered 2D Interpolation.vi

2. 2D Interpolation.vi

3. Interpolation Solver.vi - this allows you to read in an excel file which is really similar to what you want to do.

 

Also, if you are trying to do 3D interpolation take a look at the following link:

https://decibel.ni.com/content/docs/DOC-2080

 

Thank you,

Vimal Fernandez

Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(6,981 Views)

Can someone upload this "Scattered 2D Interpolation.vi" please, I do not have it.

0 Kudos
Message 5 of 8
(6,977 Views)

You'll need LV 2011 to find "Scattered 2D Interpolation" - it's brand new!  In earlier versions of LabView, you do have the option of using Mathscript, where the command "intrp2d_uneven" - in fact this is more similar to Matlab:

X = rand(5, 5);
Y = rand(5, 5);
Z = X.^2+Y.^2;
[XS, YS] = meshgrid2d(0:0.1:1);
[XS, YS, ZS] = intrp2d_uneven(X, Y, Z, XS, YS, 'v4');
surface(XS, YS, ZS)

 

Another alternative is to use a Kriging interpolation, which is essentially a weighted-distance interpolation of irregular data.  Here is a simple example of a Kriging-like interpolation.

 

Kriging Interpolation Simple_BD.png

Message 6 of 8
(6,969 Views)

Hi GregS,

 

Is it possible for you to upload the VI in the picture? Also if someone has other ideas, this is my problem:

 

I am trying to either interpolate or do a polynomial fit of a multidimensional dataset. I have N given data points, each one consisting of 6 independent variables (position in 6DOF, X,Y,Z, and the rotations around them rX,rY,rZ), and 1 independent variable that we can call Q (actually also 6, but if I can do one, I can do 6). So I want to find a polynomial function that fits Q(X,Y,Z,rX,rY,rZ), so that I can give a new (X,Y,Z,rX,rY,rZ) and obtain an estimation of Q. I will start with what is sugested in this figure, but if someone has a better idea, it will be much appreciated! for matlaba for isntance there is a script called polyfitn (and polyvaln) that does exactly that.

 

Thanks!

0 Kudos
Message 7 of 8
(6,889 Views)

Hi Pablo,

 

The image above is a snippet, so if you save the image as a PNG file, you can drag in onto your LabVIEW block diagram and it will load the code.

 

You can certainly use the Kriging method for a 6-D interpolation with this exact code, though I've never tried it.  Data Positions is a Nx6 array of the positions of your datapoints, Data Values is a N-element array of the Q values at those positions, and Interpolation Positions is an Mx6 array of the locations you want to interpolate at.

 

In terms of fitting the data, you might want to try the Non-linear Curve Fit VI, and you probably want to look for a post or code by Christian Altenbach who is the fitting guru.  But in my opinion I'd try the interpolation first and see if it gives you what you need, especially if your Q data is fairly sparse.

 

Greg

 

Message 8 of 8
(6,867 Views)