LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get value from array

i've got an array with x- and y- values.
these are points from a curve.
for my programm i need values between the x- and y- values.
what's the best way?
0 Kudos
Message 1 of 4
(3,315 Views)
Hi,
best way is "Array Subset.vi", it is not?
Input parameter is index to first X and first Y and leght of subarray [x axis and y aixis]

JCC
0 Kudos
Message 2 of 4
(3,315 Views)
Still stuck with your interpolation problem ? 🙂
You have a number of options.
Easy :
Do a linear interpolation, using dedicated LV vi's.
- separate your x and y values as two 1D-arrays,
- search the x array to find the fractionnal index number (caution : the values must be ordered !)
- interpolate the y array using the fractionnal index number.

More complicated, but more accurate : same approach, but use a polynomial, instead of a straight line
- use a third order polynomial (4 parms) to fit a curve to the y array, using 6 values, 3 on each side of the interpolated x (careful with edges), then compute the polynomial y value, using the calculated parms.

You could use directly the Polynomial Interpolation vi (Not in Base Package), but
I would not recommand it, since it uses a n-1 order polynomial to fit the data, which is a poor method when the number of points n is large.
Attached is an example of solution 1.
Ask if you need help for solution 2.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 4
(3,315 Views)
WeberM wrote in message news:<506500000008000000CFFB0000-1079395200000@exchange.ni.com>...
> i've got an array with x- and y- values.
> these are points from a curve.
> for my programm i need values between the x- and y- values.
> what's the best way?

Use an interpolation function.
Functions -> Analyze -> Mathematics -> Curve Fitting.
0 Kudos
Message 4 of 4
(3,315 Views)