08-10-2018 03:30 AM
Hello,
I'v got a question to you. I'v got two plots. They have similar x values, but diferent size. For now I created VI that is searching for upcoming value from x1 in x2, then I'm taking that array of indexes, and get right values from y2 array to my desired "interpolated" y2 array. It calculates properly, but works very slow, and when I'm trying to do it on 200k elements array it tooks 1,5min to acomplish my task.
Does anybody know how can I do it faster?
Solved! Go to Solution.
08-10-2018 04:35 AM
08-10-2018 05:01 AM
Thank you, this is what I was looking for. But could you tell me, If I can somehow speed it up?
08-10-2018 05:37 AM
08-10-2018 12:51 PM
Your code is slow because the arrays are not sorted by x and sorting is expensive for large arrays. Where does the data come from? What precision do you need? How do you measure speed? How often does this need to run?
What data are you interested in? (difference in Y? relative shift in x? etc.) Overall, you seem to have way too much data to describe the curve, so if you could somehow decimate it to a more reasonable size, if will speed up greatly. Adjacent points are currently highly correlated (redundant information!)and the same curves can be described with 5% of the points. Also, for the interpolation, you could use a linear x ramp in the range [0.1...1.2] with a few hundred points and interpolate both curves using it as x.
08-10-2018 12:58 PM - edited 08-10-2018 12:59 PM
Bonus points awarded for staying in character!
Christian wrote;
"
...Overall, you seem to have way too much data to describe the curve, so if you could somehow decimate it to a more reasonable size, if will speed up greatly.... the same curves can be described with 5% of the points....
"
Ben