LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

looking for zero crossing point

altenbach: why does your example require a shift relative to Y by 0,1 ?
0 Kudos
Message 11 of 35
(3,940 Views)

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. 😉

0 Kudos
Message 12 of 35
(3,932 Views)
I thought the same. But when I removed this "substract 0,1 from the signal" the code doesn't work anymore. And what is interesting, I've assigned my own signal to your algorithm (sure it was correct) and tried to launch VI - again nothing happens. Then, when I shifted my signal, like in your example - it started to work. I guess this happens because Signals starts from Zero and there is no value behind 0. That means code doesn't understand this like a "zero-crossing".
Message Edited by ACiDuser on 02-05-2009 02:09 PM
0 Kudos
Message 13 of 35
(3,925 Views)

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. :smileyhappy: 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. 😉

Message 14 of 35
(3,914 Views)

 

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 

0 Kudos
Message 15 of 35
(3,811 Views)

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? 😉

Message 16 of 35
(3,805 Views)

"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.

 

 

0 Kudos
Message 17 of 35
(3,793 Views)
Thanks, not it's clear, I didn't know that it works only for non-descending functions. So now is clear about inverting. Other part of code I understand. I think soon I will release FM demodulation VI without toolkit.
0 Kudos
Message 18 of 35
(3,792 Views)

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!

0 Kudos
Message 19 of 35
(3,469 Views)

subtract 0.5

 

Lynn

0 Kudos
Message 20 of 35
(3,445 Views)