09-22-2010 03:32 PM
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!
09-22-2010 03:45 PM
Have you tried the Waveform Peak Detector VI? It returns an array of amplitudes that meet certain peak defenition criteria.
09-22-2010 03:51 PM
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
09-22-2010 03:53 PM
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!
09-22-2010 04:01 PM
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.
09-22-2010 04:24 PM - edited 09-22-2010 04:28 PM
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:
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.
09-22-2010 04:26 PM
@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).
09-22-2010 05:13 PM
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?
09-22-2010 05:55 PM
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!