# LabVIEW

cancel
Showing results for
Did you mean:

Highlighted

## searching an array by sections

Hi all

I have recorded real world data. The data is a sinusoidal waveform that each pulse is a different length with each peak and troff being of different amplitudes.
I have got a zero crossing vi that searches the array and finds each zero crossing and returns the index of that zero crossing. So you end up with an array of certain points of the original array to calculate pulse widths of each individual pulse.
Now I know where each pulse starts and ends (crosses the zero and re-crosses the zero) I want to search for the highest absolute amplitude out of this section. Once this is done I will them search the next pulse and so on. This will then tell me the maximum amplitude from each individual pulse.
It sounds simple but I'm struggling.

If anyone has got any information on how I can do this it would really help
Message 1 of 9
(1,643 Views)

## Re: searching an array by sections

Since you know how long the waveform is, use the Get Waveform Subset VI in the Waveform palette. Then use the Waveform Min Max VI in the Waveform >> Analog Wfm palette

Message 2 of 9
(1,633 Views)
Highlighted

## Re: searching an array by sections

when you want to find picks there is problem
sometimes some pick are not picks that you want
picks vi work base on mathematic differential equation and some times it could find the pick that is just pick of noise
in this vi the pick that are in range up to 60 % of max pick selected

Message 3 of 9
(1,603 Views)
Highlighted

## Re: searching an array by sections

Sounds like you have most of the logic down in your head. This will get you most of the way there, but you have to put in your own data and zero crossings. It will give you the peak between each zero crossing. So if you put in 10 crossings, you'll get 9 peaks back, I hope this is what you expect.

Message 4 of 9
(1,549 Views)
Highlighted

## Re: searching an array by sections

@Gregory wrote:

Sounds like you have most of the logic down in your head. This will get you most of the way there, but you have to put in your own data and zero crossings. It will give you the peak between each zero crossing. So if you put in 10 crossings, you'll get 9 peaks back, I hope this is what you expect.

Just a bit off there Gregory

Try a bit simpler solution since the number of "Crossings" is discoverable

"Should be" isn't "Is" -Jay
Message 5 of 9
(1,529 Views)
Highlighted

## Re: searching an array by sections

Nice Jeff, I like the For loop. When you say "off" do you mean "more complex than it needed to be" or "not giving a correct result"?

Message 6 of 9
(1,519 Views)
Highlighted

## Re: searching an array by sections

@JÞB wrote:

Try a bit simpler solution since the number of "Crossings" is discoverable

Jeff, I think you are missing a Subtract right before the Array Subset since the bottom input is supposed to be a Length and not and final index.

Spoiler
Just being thorough

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 7 of 9
(1,513 Views)
Highlighted

## Re: searching an array by sections

Jeff, I think you are missing a Subtract right before the Array Subset since the bottom input is supposed to be a Length and not and final index.

Yes Tim, Thanks.  I rushed.

@ Gregory that "off" was looking at two issues.  1 if no zero crossings are seen the while loop is a poor choice (You get a array of[0] out vice the correct empty array) a for loop is the only way to solve that.   2 the abs val serves no purpose there (but probably does for the case where there are zero crossings in the data) better to abs val the array once outside the loop rather than abs val each chunk.

Spoiler
Just being thourough- it was some nice code with an edge case that could blow-up
"Should be" isn't "Is" -Jay
Message 8 of 9
(1,493 Views)
Highlighted

## Re: searching an array by sections

I see, both good points, thanks 🙂

Message 9 of 9
(1,481 Views)