LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the maximum value of an array of peaks?

HI!

   My problem is to display a line at 50% of the maximum value of a waveform or whatever percent it is that I want. I tried doing it with a sine waveform so I could use the same logic on my actual waveform, but the difference between that and the sine waveform is the amplitude is same for the sine waveform at all times, so the line I get is straight. but when I apply it to the actual program, it gives me crooked line due to varying amplitude. The plan is to read  the waveform for like 5 seconds and from the range of amplitude values that I get, I select the maximum value and take that as 100% and display the line accordingly. But I don't seem to get a hang of how to do it. I am new to labview so I might have missed some really simple VI that could do the trick. Could someone help me on that?

 

Thank you!

0 Kudos
Message 1 of 9
(5,551 Views)

Have you tried the Waveform Peak Detector VI?  It returns an array of amplitudes that meet certain peak defenition criteria.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 9
(5,541 Views)

I agree with NIquist, the Peak Detector will help you find the peaks.

From there, I would use a cursor to draw a horizontal line at a given y-value

Cory K
0 Kudos
Message 3 of 9
(5,532 Views)

Hi NIquist!

I tried that too, this is my feeble attempt at achieving the final result. I tried using a for loop to get the maximum amplitudes over a period of time, but it will obviously keep going because it's in a while loop. My explanation is quite blurred, but it might help if you see the attachment.

 

Thank you!

0 Kudos
Message 4 of 9
(5,527 Views)

The problem is, I want the peak values only for 'so' long, and then out of all the values I get, I choose the maximum value and use it to display a line. I thought a simpler way to do is to use the DC 'waveform' generator, so for the offset of the DC, I give this maximum value so it displays a line. I hope I made my point clear.

0 Kudos
Message 5 of 9
(5,520 Views)

Play around with this.  You may have to change the peak detector inputs to accomodate your particular signals.  Peak shape and noise can confuse it (as does the straight 'slope' of the sawtooth wave).

 

I had LV2010 open when I looked at your VI.  Here's a pic if you can't open it:

24516i03058E0FE9597483

 

EDIT:  I forgot to show the labels.  'Triangle Waveform.vi' and 'Waveform Peak Detector.vi'.  Search for them if you don't know which palette.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 9
(5,513 Views)

 


@A BME wrote:

The problem is, I want the peak values only for 'so' long, and then out of all the values I get, I choose the maximum value and use it to display a line. I thought a simpler way to do is to use the DC 'waveform' generator, so for the offset of the DC, I give this maximum value so it displays a line. I hope I made my point clear.


That'll work too if you don't want to use cursors (like I did).

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 9
(5,512 Views)

I started using labview only a couple of weeks back, and I somehow didnt get the hang of peak detector vi still. I basically have no idea what to put for the width of the waveform.

Also, I was wondering if the VI would become too complex if I don't use the active cursor?

0 Kudos
Message 8 of 9
(5,498 Views)

I need help with this. I tried using for-loop to calculate the peak for sometime, but it seems like the min&max vi does not take 1D arrays. Is there any vi i can add between the for loop and the min&max vi to make this work?

 

Thank you!

0 Kudos
Message 9 of 9
(5,494 Views)