From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the turning point in data array

Dear Labview community members:

Happy Holidays to all.

I need to find the turning point in my data array, I have not figured it out how to do it. I hope you can give me some hints. my data array has two columns, one is for time another is for my data collected from a instrument. Bascially, the data is a triagle wave with some noise (see the attached picture for details). my question is how to find at what time  the turning point (maximum and minimum) appears, Untitled.jpg

0 Kudos
Message 1 of 8
(3,941 Views)

Before you can program, you have to be able write down in words what you need to do.

 

Can you do that? Are you able to articulate in words the steps - the algorithm - for processing your array(s) of data?

 

Once you are able to do that, you then use whichever programming language you want to use to implement those steps.

0 Kudos
Message 2 of 8
(3,919 Views)

Interpolate the signal. Use the first derivate and determine the x values where it equals 0.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 8
(3,917 Views)

In the signal processing palette, there is a 'Peak Detector' VI - http://zone.ni.com/reference/en-XX/help/371361J-01/lvanls/peak_detector/

 

2015-11-26_15-24-40.png

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 8
(3,912 Views)

Can you show us some typical data? (If there is any noise, most likely every other point is a turning point on some scale. :))

Is the data always a regular triangular wave? Are the segments always close to linear? Is the freqeuncy fixed? You probably want to look for jumps in the first derivative of the data (or even peaks in the absolute second derivative). Are the start and end point really "tunring points" as you marked in your graph?

0 Kudos
Message 5 of 8
(3,895 Views)

here I posted a vi that should be able to solve that even for very noisy data (and you can define a minimum vertical turnpoint distance) . It takes only a 1D data but thats easy to adapt to your problem.

The output is an array that contains the value and its index.

 

 

 

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 8
(3,888 Views)

Hi:

attached is the data I got. the data is always a triangle wave. The ramp rate should be the same in one run, but, it can be different from run to run, it can vary from 1mV/second to 1V/second.

each segament in the triangle wave is or should be linear. I think derivative may not work, this is becuase the derivative can magnify noise, if the ramp rate is very slow, it could be difficult to identify the change from positive to negative in the 1st derivative if there noise is also magnified. please give me some advice.

again, thank you

0 Kudos
Message 7 of 8
(3,866 Views)

@Peter109 wrote:

Hi:

attached is the data I got. the data is always a triangle wave. The ramp rate should be the same in one run, but, it can be different from run to run, it can vary from 1mV/second to 1V/second.

each segament in the triangle wave is or should be linear. I think derivative may not work, this is becuase the derivative can magnify noise, if the ramp rate is very slow, it could be difficult to identify the change from positive to negative in the 1st derivative if there noise is also magnified. please give me some advice.

again, thank you


Only the one that try can fail, others have already lost 😉

 

I don't want to interpret xlsx data ....   since you want to write your program in LabVIEW , post your try and include the data (as a constant?)

 

Another method could be:

Take the min/max value of your data (or the RMS , or ..)  to get a good guess for the top and botton 5% of your triangles.

Cut out the peaks

fit a line (linear fit) on the intersections

use a little math to calculate the peak values and position (intersection of two lines... you remember your math class?)

 

 

Another method: could be very noise robust 😉

If the triangle of one run is of constant frequency

Capture 5 or more periodes

Use tone detection to find amplitude and phase of the basic frequency

With amplitude and phase  of the base frequency known you can make very good guesses of the turnpoints

Again apply a linear fit of the intersections

...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 8
(3,852 Views)