02-05-2009 11:53 AM
02-05-2009 12:55 PM
ACiDuser wrote:
altenbach: why does your example require a shift relative to Y by 0,1 ?
It does not! It just makes the data a bit more interesting and the zero crossings less regulary spaced. 😄
The interesting part is the algorithm, not the simulated data. 😉
02-05-2009 02:07 PM - edited 02-05-2009 02:09 PM
02-05-2009 02:57 PM
Yes, there is a problem if the data starts out with zero, but to my defense, I said that:
"(It currently fails if a value is exactly zero and the function does not switch sign afterward. It just needs a bit more code to fix that. Modify as needed.)"
If you don't add an offset, the data starts with a value of zero and thus fails. Try adding a "+1" after the "to I32" and see if things improve. No guarantees. 😉
05-26-2009 01:50 AM
Huh, spent alot of time researching your algorithm 🙂
I can say that I still understand only separate parts of your code.
Could you tell me what do two inputs, one of which gets negated, and a ternary expression ?
What are they for in this code?
Thanks
05-26-2009 02:10 AM
ACiDuser wrote:Could you tell me what do two inputs, one of which gets negated, and a ternary expression ?
What are they for in this code?
We are trying to find zero crossings using threshold 1D array. This only works correctly for non-descending functions. So, once we find a zero crossing going from negative to positive, the next one will go from positive to negative, which is bad for the algorithm. So what we need to do is invert the function after each found position.
Why don't you simply play around. Place a few probes, make a few minor changes (e.g. don't invert, etc.) and see how the result changes? 😉
05-26-2009 02:21 AM
"Why don't you simply play around. Place a few probes, make a few minor changes (e.g. don't invert, etc.) and see how the result changes?"
hehe 😄 Most of time, when I changed something - nothing worked. But I am able to demodulate FM signal using your code 🙂 The only minus is - loss of small amount of data just before the first zero crossing and after the last crossing.
05-26-2009 02:27 AM
07-28-2010 03:25 PM
Hello all,
I have a similar problem in detecting zero crossing values of a wave function. I checked the altenbach's code, but the problem with my curves is, the wave function is a normalized curve and it changes between 0 and 1. I need to find the zero crossing values, or the points where the slope of the curve changes sign from negative to positive or positive to negative.
Any toughts or help is appriciated. Thanks!
07-28-2010 03:32 PM
subtract 0.5
Lynn