LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Equalize delta x of multiple XY curves

To track the maximum of a number of XY curves we're planning to resample all the XY curves so that they all have values for the same X and the job just becomes a question of finding the maximum for all X values...

However, the curves does not have a constant delta X, so using the waveform resampling function is not possible. Has anyone already made a function that resamples XY curves with variable delta X?
0 Kudos
Message 1 of 3
(2,761 Views)
"resampling" is not the correct word. Look for "interpolation" instead.
1) use the "General Polynomial Fit.vi" to obtain the coefficients of a
polynomial that fits your each curve. Choose an order which is high enough
to fit your data and reject noise at the same time.
2) use "1D Polynomial Evaluation.vi" to obtain the y value corresponding to
the new x

But you can even find the maximums without resampling/interpolating :
1) use the "General Polynomial Fit.vi" as above
2) use my "Polynomial Derivative.vi"
(http://dynabits.com/labview/libview.htm, or rewrite it, it's easy 😉 to
obtain the coeffs of the derived polynomial
3) use the "Complex Polynomial Roots.vi" and "Categorize Roots.vi" as in the
"Real Roots Example.vi" to obtain the roots of the deriva
tive of the
polynomial, which happen to be the x values of all maximums and minimums of
your curve
4) use "1D Polynomial Evaluation.vi" to obtain the value of those max/mins
and the values of the other curves at these points only.

This solution looks a bit complicated at first sight, but it will be much
more compact and efficient in the end. If you meet problems, tell me and
I'll add a "Polynomial Max&Mins.vi" to my library, but you'll have to pay
for it ($100 with diagram)


Philippe Guglielmetti - www.dynabits.com
0 Kudos
Message 2 of 3
(2,761 Views)
Thanks. Using a polynominal fit is probably faster in general.

I've made a solution for my specific problem now though, working on the data directly. It's not a time critical operation in this case so it's OK.

(Resampling is the word NI uses in it's own functions that does this exact thing but only on curves with a constant sampling period; look at e.g. the Express VI to resample and align waveform...Interpolation is a part of the problem, that's why that VI let's you choose type of interpolation....)
0 Kudos
Message 3 of 3
(2,761 Views)