06-20-2018 04:50 AM
Hi,
I am looking to take an analog signal and fit a square wave onto it, as shown in the attached picture (I added the red line in Powerpoint, but this is what I would like to achieve programmatically).
This will allow me to condense some complex data down to just the key information of magnitude and duration for each square wave.
I have searched the forums and LabVIEW help but am really not sure how to approach this. Will it require a completely custom solution of can I make use of existing analysis tools? Any suggestions would be much appreciated.
Many thanks for your help,
Robin
06-20-2018 05:11 AM
First you need to define an algorithm.
How do you determine the transition point?
How do you determine the high and low levels?
06-20-2018 05:26 AM
Hi, thanks for the reply.
The transition point would be determined from looking at the slope - a very steep slope would indicate a rise or fall. Conversely, a low slope would indicate a flat section where it remains at the current value.
To prevent constant fluctuation, there would have to be some averaging in there.
The high and low levels can be any value (they're not locked to 1/0) and the level should be an average over the square.
In terms of an algorithm, it would look like this:
1) Detect a rising edge from a large slope.
2) Wait until a falling edge is detected from a dropping slope.
3) Average the values between the rise and fall to determine the level of the square.
Thank you for your help.
06-20-2018 06:26 AM
What is a steep slope?
What is the average between rising and falling? When is the rising considered complete?
You can use the moving average.
06-20-2018 07:45 AM
Can you not just use the Analog to Digital waveform converter?
06-20-2018 09:32 AM
Thanks for your suggestion - I think I may have been able to do this, but I'm not sure whether using a digital waveform would quite give the behavior required.
I've managed to achieve this now by averaging the signal values and then using the 'round to nearest' function.
This creates the square waves as intended.
Thank you for all your help.