LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find Peaks Treshold History

Hello There, 

 

I am trying to find peaks and valleys in my Pitch angle from an IMU to properly segment signal features. I am using an example Peak Detector Comparison. VI. I modified it to be able to record Peaks and Valleys at the same time and since my signal is not fixed at zero, I tried to calculate the dynamic threshold level. It looks like this works but the problem is that whenever the signal finds a new feature (Peak / Valley), the height of the threshold rejects previously found features. Is there any possibility for the Peak Detector to detect peaks / valleys only from a newly received signal?

 

Thanks 

 

Boris

 

Peak detection on Pitch Signal.Peak detection on Pitch Signal.

 

I added VI snippet.

 

 

 

0 Kudos
Message 1 of 5
(2,191 Views)

The problem isn't clear.

 

The images shows lots of peaks and valleys, so how are previous found features rejected?

 

What do you expect and what exactly isn't what you expect?

 

Can't try your code, still in LV18.

 

BTW. You can divide an array by a scalar... Those for loops are redundant and can be removed.

0 Kudos
Message 2 of 5
(2,127 Views)

I tried to record my problem as it is better to describe on, the signal is the pitch from my IMU and the cursor shows the threshold value set for both Peak detectors (Peak, Valley) that equals to the signal level divided by sqrt (2). As you can see, whenever the threshold value is changed and exceeds previous values, the already found peaks/valleys also disappear.

 

PS: sorry for the annoying music, I accidentally uploaded background music that can contain copyrights, so I was forced to overlay the clip with copyright free music.

 

0 Kudos
Message 3 of 5
(2,113 Views)

Why not just upload a video that has no sound?

 

What you need to do is not reevalutate the peaks and valleys every iteration.

 

Once you determined you have a new peak or valley, store that in an array.  So you maintain an array of found peaks and valleys in shift registers that you display rather than the peaks and valleys that are calculated on every iteration

0 Kudos
Message 4 of 5
(2,108 Views)

The Peak Detector PtByPt.vi might do a better job.

 

You can get a reasonable threshold from a Mean PtByPt.vi, probably with a larger width.

 

EDIT: And indeed use shift register to keep old values.

0 Kudos
Message 5 of 5
(2,091 Views)