LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Peak to Peak Detection Problem

I am having difficulty making the peak to peak detection work. The idea is to send a waveform signal that is converted from dynamic into the Peak to Peak VI to obtain the index of a few different peak locations on my graph. I would then take the index, which would be time in this case to obtain a delta time in order to align my values for superimposing two different graphs. However, I appear to be getting 0 every time I run the peak to peak VI.

 

Block Diagram.png

 

Front Panel.png

0 Kudos
Message 1 of 10
(3,817 Views)

Can you attach an example VI?

 

It is hard to tell from the pictures if the issue may be the peak to peak being outside the loop. 

 

You also are not giving any inputs to the peak detector so you have not set a width or a threshhold.  The base may work.. but it is hard to tell without an example.  Even saving the graph you expect with default values would allow us to run it even without the hardware you have attached.

0 Kudos
Message 2 of 10
(3,800 Views)

I have posted the VI for the problem I am having. The peak detection is not within the main loop but rather connected outside of it. 

0 Kudos
Message 3 of 10
(3,794 Views)

The items were placed into the main loop, however I am getting indexes of -30, which I find very odd since the graph's x-axis is setup to be from 0-0.1 seconds.

0 Kudos
Message 4 of 10
(3,785 Views)

Peak Detector VI returns not the values of the x axis, but rather the index of peak in the input array. So if you need the distance between the peaks in time units, you have to index the x axis array with the indexes found with the Peak Detector, and only after subtract the values to get the distance.

 

Also you are subtracting next index from the previous, so you will always get negative result.

 

Thanks,

Arev 

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 5 of 10
(3,766 Views)

@emmaaleia wrote:

The items were placed into the main loop, however I am getting indexes of -30, which I find very odd since the graph's x-axis is setup to be from 0-0.1 seconds.


Flip the inputs on your subtraction inside of that FOR loop.

 

But those values are indexes.  You need to multiply by your same rate in order to get the time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(3,759 Views)

Could you please show me an example VI or image of  how to exactly execute this? I have tried tweaking the program, however my indexs are quite large and I am relatively new to the LabVIEW programming language.

 

Block Diagram.pngFront Panel.png

0 Kudos
Message 7 of 10
(3,755 Views)

Hi,

 

I have multipled my rate value by what it should be and my numbers are matching up to exactly what they should be, however my number of peaks found says 25, when I only see that there should be only 5 peaks according to my graph.

0 Kudos
Message 8 of 10
(3,729 Views)

I think you have some noise in the signal. Try to increase the width, when doing peak detection.

 

Thanks,

Arev 

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 9 of 10
(3,720 Views)

Try graphing just the waveform that you are using for peak detection.  Also, make sure autoscaling on the X axis is on.  It looks like there really are 25 peaks, but you are only displaying the first 5.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 10 of 10
(3,615 Views)