# Function InterpolatePoly

## Recommended Posts

Hello,
I am using DaqFactory version 19.1.

I saw that there was a function InterpolatePoly(X Array, Y Array, Interpolate To Array X)

I don't understand how to use the function, the input parameters and the output of the function.

Can you help me with more precision or an example please?

PELLICIER Ludovic

##### Share on other sites

First, this function is largely deprecated and may not be available in 20.1.  If you are just trying to smooth a graph, either use the spline line type for the graph, or use smooth() or other averaging.

But, that said, this function takes an X / Y trace defined by arrays of X and Y points (X array and Y Array) and then does an interpolation to give you new Y values for the array of values in Interpolate to Array X.  I've provided a simple example.  Note that the function does not work particularly well at the ends.  In fact, I find the function to not work particular well in general, which is why I recommend using other methods for data smoothing.  If you'd like to give me your use case, I can better identify what you should use instead.

##### Share on other sites

• 2 months later...

I am trying to build in a method to estimate a value based on two arrays.  I am not looking to graph this out, but rather have a value input into a csv file at various times.  The interpolate function appears to work well for what I am looking to accomplish.  Your post on Jan 10 indicates this may be going away in 20.1.  I don't necessarily want to build in functionality that will be extinct in a newer version knowingly.  Do you have a simple way of doing this without the interpolate function if I'm not looking for a graph specifically?

Example:

Array 1:  100,75,50,25,10

Array2:  24.58,17.42,17.59,10.13,6.46

Using the Interpolate function, I can look at a specific value like 38 and determine the corresponding value in Array2 (14.3001008) easily in a sequence with this simple function.  If there is another way to do this that I'm not thinking of that would be relatively simple I would love to explore that option.

Thanks

##### Share on other sites

In this particular case, deprecation will likely just be removing from the documentation, though I'm not sure we will even go that far with it, especially given your feedback.  There really is no reason to remove it as it is just a simple math function.  The menu driven interpolation will definitely go, however, but you aren't using that.  The challenge with it is that it really does not work well at the ends.  So, in your example, it probably won't give you a reasonable answer if you asked for 125 or 3 as these are past the ends of array 1.

##### Share on other sites

Understood and thanks for the feedback.  It's GREAT to see a company listen to its customers as well and as quickly as you do!

##### Share on other sites

• 3 months later...

As a follow-up question to this, you mentioned that the Interpolate function doesn't work well particularly at the ends.  Is there another function you would recommend that DAQFactory is capable of?  I'm finding that when I look at a 4th order polynomial function of my matrices, the interpolatepoly function doesn't really match the results of this.

##### Share on other sites

No.  DAQFactory was never designed to be a data analysis tool.  It just has some basic functions.  Of course you could extend it using the extern() function to bring in a DLL, but truthfully, you can't really interpolate at the ends well with any tool without making a bunch of assumptions.  If you know its a 4th order polynomial, then that is a piece of data that would help make the interpolation more accurate, but DAQFactory's interpolate tool doesn't take that into account.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.