04-28-2015 04:55 PM
The attached VI illustrates the behaviour, and also a workaround, making the X values ever-so-slightly different, to force the Interpolate 1D to give the correct(?!) answer
04-28-2015 05:00 PM
Oh- and I do have a bug report in for this: (Reference#7446701)
04-28-2015 05:47 PM - edited 04-28-2015 05:50 PM
Why not use the tools from the array palette?
(Of course the FOR loop is not needed for a single interpolation value, just tring to duplicate your setup)
04-28-2015 06:36 PM
Well... umm... errr... Yep.. That works... 😉
I didn't know (or had forgotten) Interpolate 1D Array (one of my favourite VIs) did that..! Do now, reading the help..!
But... it's perhaps not very well behaved if you reverse the Xs...
And... I don't think that solution works for my full use case, where I was expecting (obviously incorrectly) Interpolate 1D to perform a linear fit through all the data I gave it- not silently ignore repeated points- before interpolating an output.
I guess, describing it like that, I ought just use a linear fit 😉 Interpolate 1D only "joins the dots"- it's perhaps just a little unclear which dots it's going to use...
04-28-2015 06:40 PM
04-28-2015 06:42 PM
Exactly, so while Altenbach's reply was indeed correct for the example data, it is not robust 😉
04-28-2015 10:00 PM
04-29-2015 06:29 AM
@mikeporter wrote:
The 1D interpolation expects an array with increasing values. Also if the first value in the array is greater than the threshold, it gets lost.
Just to clarify here, the Interploate 1D Array function just needs an increasing X value. The Y values do not need to be sorted at all. And it performs a linear interpolation between two points surounding the fractional index.
04-29-2015 11:24 AM
Workarounds- and the wrapping required to make them robust- notwithstanding, do we think it's a bug that Interpolate 1D appears to use only the first of any repeated X values? If it is intended to be simple "join the dots" interpolation, should it not at least use data in the order it appears at its inputs...?
Meanwhile, I will replace my use of it with a proper linear fit between my two clumps of data, as I should have done all along... 😉