04-20-2006 09:57 AM
04-21-2006 04:53 PM
I have some ideas on how to perform these tasks, but it is to be said that I never faced such a problem so consider them as suggestions to work on...
Task 5: the simpler. MaxMin1D on your waveform permits you to decide wether the trigger value was reached or not. If so, proceed to step 6.
Task 6: on this I only have teorical ideas to submit to you (apart from scanning the waveform and comparing every two elements with the limit). If you subtract from your array the trigger value, you'll have negative values for figures below the limit and positive on values over the limit. Your problem then reduces to setting up some kind of zero-crossing detector.
I found in this post an useful idea on how to perform this task: Enrique has said: "A common way to do so is by multiplying the previous number and the current number. If the product is positive, both has the same sign and thus there was no zero crossing. If the product is negative, there was a zero crossing." To do so, you can multiply original array by the same array shifted by 1, put the result in a second array and pass this result array with a loop exiting on the first negative value. Something like this:
Suppose your waveform is stored in an array named data and that it is long samples elements. Create a new array result with the same lenght.
// Subtract the limit value
Set1D (result, samples, limit);
Sub1D (data, result, samples, data);
// Obtain the sign and scan the array
Mul1D (data, data + 1, samples - 1, result);
for (i = 0; i < samples - 1; i++) {
if (result[i] < 0) break;
}
I hope these suggestions can help you in developing your application
Roberto