‎02-09-2006 10:55 AM
‎02-09-2006 11:31 AM - edited ‎02-09-2006 11:31 AM
Message Edited by altenbach on 02-09-2006 09:35 AM
‎02-09-2006 12:26 PM
‎10-28-2013 09:55 AM
Hi,
I was searching for 2D interpolation and extrapolation and found this thread among others. Interpolation is fine, but for 2D extrapolation, the linear and cubic method gives NaN. Is there a function am unaware of that can take care of 'extrapolating' using some kind of data-fit, and let me have those values that lie outside the initial input data-set.
Thanks.
‎10-28-2013 10:32 AM - edited ‎10-28-2013 10:34 AM
@nskatlv wrote:
Is there a function am unaware of that can take care of 'extrapolating' using some kind of data-fit, and let me have those values that lie outside the initial input data-set.
The keyword is "fit" here. Do you have a mathematical model for your surface as a function of X and Y? Once you have a fit for the visible portion, you can calculate the model outside the xy range of the original data.
There are plently of 2D fit examples posted here. Can you be a bit more specific about the kind of data you have? If it is relatively featureless, a 2D polynomial surface might be sufficient.
(Of course I recommend you start your own new thread for this new discussion!)
‎10-28-2013 11:17 AM
Thanks for the reply altenbach.
I guess if I have a function for the data, I won't need inter/extrapolation at all. I can just plot it as such.
I was thinking that the inter/extrapolation functions might take care of this fitting business outside the input [x,y] domain. They don't.
But your suggestion of fitting it first is worthwhile, and once I fit the data, I guess I won't be needing the interpolation function anymore. I can just generate input vectors (in a grid), calculate the z and plot it.
Let me try fitting myself and will start a new thread if I fail.
Thanks & Regards.
‎10-28-2013 04:40 PM
The problem with extrapolating is that the results are unconstrained - unless you impose some expectations, which is what is part of the fitting process. A low-order polynomial fit will tend to maintain derivatives at the boundaries of the input region, but even a cubic can easily diverge very quickly from the input data.
There are ways to inter/extrapolate without fitting though. One method I use is a Kriging interpolation, which is also reasonably well-behaved outside the input data, and works for an irregular spacing of input data points. There are a lot of possibilities for imposing constraints on the mapping (have a search for Kriging and variograms), but the most simple approach is to just use weightings of the distance to the input data, which tends towards the average of the input values as the distance gets large. I've posted about it before: http://forums.ni.com/t5/LabVIEW/2D-array-or-3D-array-interpolation-need-help/m-p/1681014#M598046 In recent versions of LabVIEW (2011+ I think), the Interpolate 2D Scattered function using the Greens method uses pretty much the same approach, though I think has problems with two data points at the same location (i.e. distance=0 between them).