03-24-2020 12:26 PM
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.
I added VI snippet.
03-26-2020 07:49 AM
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.
03-26-2020 02:11 PM
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.
03-26-2020 02:22 PM - edited 03-26-2020 02:23 PM
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
03-27-2020 02:54 AM - edited 03-27-2020 03:00 AM
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.