LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Collecting multiple Max Min points from a non uniform sinousodal signal.

I cannot open the VI, I am using LV 2017 version. Your version is different than mine. Can you please upload it again ?

0 Kudos
Message 11 of 27
(870 Views)

Please, ignore my ignorance. Can you please tell me about how you did it step by step ?

0 Kudos
Message 12 of 27
(866 Views)

Saved for 2017.

 

I included comments of @altenbach's algorithm in my .vi, but here it is in pictures, in case it helps:

Spoiler
Here's the original sinusoidal waveform:
Step0.PNG


We find the mean and offset the graph by that amount. So, now it's centered around 0.

Step1.PNG

This part may look weird, but it's each element of the array multiplied by the next element in the array.
Result: For each instance that the original graph crosses zero, there is a negative (*barely* less than zero) value.
So here are all the less-than-zeroes of the multiplied graph:

Step2.PNG

And here are those cursors super-imposed onto the shifted graph:

Step3.PNG


We then find the most extreme value (either max or min) in between each set of vertical (yellow) cursors.
(It just dawned on me...I hope you're not colorblind.)
These extrema (maxima and minima) are shown with red cursors here:

Step4.PNG


@altenbach then used that information to produce this graph:

Step5.PNG

 

All I really added to the .vi was a way to sort whether each extreme was a max or min.
I then index the maxima and minima separately to create a "max" array and "min" array, from which the peak-to-peak value was derived.

Also, kudos to this post (also by @altenbach) that taught me how to do the vertical cursors.

-joeorbob

Message 13 of 27
(846 Views)

Thanks for your help. This method is queit good but i still am having problems with it. Like it sometimes does not take a Max or min point at the start of the graph and in the end of the graph it takes the mid value which is not the max or min point. I have attach the image to address my concerns

0 Kudos
Message 14 of 27
(825 Views)

@Pukhtun_Yum wrote:

Thanks for your help. This method is queit good but i still am having problems with it. Like it sometimes does not take a Max or min point at the start of the graph and in the end of the graph it takes the mid value which is not the max or min point. I have attach the image to address my concerns


That's why I said "probably needs a few tweaks depending on the phase near the edges.". Would be easy to fix on both sides, but I left it out for simplicity.

 

On the left, we need to check if the first points of the data is descending or ascending and on right left we need to make sure that we ignore maxima unless both sides have a zero crossing. What have you tried?

 

If you think you need help with that, attach the new data.

0 Kudos
Message 15 of 27
(819 Views)

Hey, thanks for your guidance. I tried to figure it out but was unable to do it. Can you please have a look and fix this issue.

 

0 Kudos
Message 16 of 27
(818 Views)

For the left side, start with index zero instead of the first zero crossing. For the left side, make the two auto-indexing output tunnels conditional and wire the loop termination condition to their lower input. (I actually already designed for that by using the unusual "continue if true" mode)

 

altenbach_0-1601662815692.png

 

 

This works for the current data. Of course you need to make it "slightly smarter" so it detects if there is a peak (or not!) before/after the last zero crossing. (not shown). A simple solution would be to only make the correction to the autoindexing tunnels as described. This way it will only count extrema that are between zero crossings. While that would drop the first peak here, maybe that's a loss we can take.

 

Another option would be to look for zero crossings in the second derivative. (also not show), giving the peaks directly!

 

You just need to be a bit more creative. 😉

Message 17 of 27
(803 Views)

@altenbach wrote:

 

Another option would be to look for zero crossings in the second derivative. (also not show), giving the peaks directly!

 

You just need to be a bit more creative. 😉


Here's a version that uses the zero crossings of the first derivative to find the starting index and ending condition.

The derivative is a simple finite difference, so it's pretty susceptible to noise - that's why I still used @altenbach's code for the main algorithm, instead of finding the peaks directly.

 

Spoiler
PPVoltage_MOD_JoB2 graph.PNG

 

Anyway, it's a fish for you. Learn from it what you can.

-joeorbob

 

(P.S. @altenbach, how close am I to making some Rube Goldberg Code😁)

0 Kudos
Message 18 of 27
(791 Views)

@User002 wrote:
(P.S. @altenbach, how close am I to making some Rube Goldberg Code😁)

I was able to simplify it "slightly" by adding some filtering to the derivative before finding the zero crossings. Note that anything that exclusively contributes to the 2D array can be deleted because it is just for display. Also note that due to the filtering, the result might not agree exactly.

 

altenbach_0-1601682088043.png

 

 

altenbach_1-1601682167206.png

 

I still like my original better because it might show trends how the amplitude behaves as a function of time.

Message 19 of 27
(780 Views)

Thanks again for your contineous help. I have been busy with other stuff and now I am back to the VI that you helped me in. I understood the logic of the VI but not 100%. Thats why I am still facing problems in it, The data that i am recieving from DAQ is not pure sine and because of that the VI takes min max points at the mid of the wave as shown in the images that i have attached. Can you guide me about what to be done so that the VI just takes only the MAX and MIN points and not any other ?

Download All
0 Kudos
Message 20 of 27
(611 Views)