LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Recreating the Spline Interpolant VI

Hello I am trying to understand how the Spline Interpolant VI works and decided to recreate a copy of it using LabVIEW primitives instead of the lib called by the built in VI.

 

I have looked into cubic spline interpolation and have found a few examples to help me understand how it works but reading the documentation and trying to recreate this functionality of returning the interpolant array (array of second derivatives) is proving harder than I expected.

 

I have reduced the equations in the example to there simplest form and can work out a 2 point example on paper but how do I expand this to code?

 

Capture.PNG

I have implemented code to fill out the coefficients of each equation in the help details but am not sure what to do from there. Attached is my code so far

0 Kudos
Message 1 of 3
(1,822 Views)

To go from 3 points to N points, it might help to have three cases:  If i = 0, do the i = 0 code, else if i = n-1, do the i = n-1 code, else do the "intermediate points" code (which can be done with a single For loop with the loop count = N-2).  I haven't checked your code to see if it correctly implements these three cases for N = 3, but assuming they are correct, such a simple "unfolding" into "edge code" and "center code" might be all you need.  Note that you should guard against calling this with 0, 1, or 2 points ...

 

Bob Schor

0 Kudos
Message 2 of 3
(1,779 Views)

Hello Bob,

Good call in guarding the inputs, I'll be sure to implement that.

 

I have successfully implemented the case structure & for loop but I'm not sure how to solve for the interpolant array. Currently I am at the point where I can get all the coefficients to the equations in the help documentation.

Capture.PNG

Thank you for your help so far

0 Kudos
Message 3 of 3
(1,727 Views)