12-20-2011 01:41 PM
I have two signals.
Signal 1: 0-5V trigger signal. During the time duration of interest, the trigger will go high 4 times for 1ms each. In my software, I need to find the last trigger, which I can do easily.
Signal 2: From about 0 to 30ms, the signal is noise with level +- 40mV. From about 30ms and up, the signal is noise with level +-5mV.
I am suposed to find the time dfference between when the last trigger of signal 1 occurs and when signal 2 becomes +-5mV.
I tried to do this by flipping the two signal arrays and find the elements in the arrays where specified thresheds are crossed. Of course, the threshold for signal one is dffierent than signal 2. The described approach only works 50% of the times. The method fails when ignal 2 has spikes during the +-5mV period, which occurs once in a while.
Any inputs on algorithm? Thanks! See attached for a pictorial explaination
12-20-2011 04:17 PM
Attached is my attempt at the problem. I introduced a guard band on my search. I only ran a few test cases, and I will try it out tomorrow. If you have better ideas, let me know. Thanks!
12-21-2011 02:14 PM
Jyang,
Is there an acceptable absolute maximum for the noise around +/- 5mV. As long as the values stays below that absolute maximum for X number of readings. If you are just measuring noise, there really isn't a guarantee that your timing won't be off. What if you have a section of noise in your specificed section of 40mV area that stays under the threshold? Later on it swings back up to 40mV. It could be considered a false reading. So you would need to do a running history of how many readings in the threshold area are acceptable.
01-04-2012 12:52 PM
The high section and low sections are pretty consistant. Only the short duration spikes at th low section can cause a problem. However, I designed in a guard band to get around that. If I find a high, I make sure that the next high is very close by. If now, it is only a spike.