07-28-2010 03:54 PM
Hey Lynn,
I thought of that but the peaks are not exactly centered at 0.5. The zero crossing values are shifting between 0.4 and 0.6.
07-28-2010 07:40 PM
Eunsal wrote: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.
Seems you are dealing with a different problem, because you don't want the zero crossing of the signal, but the zero crossing of the first derivative of the signal. (they wont necessarily be the same for real world data).
In theory, you can just take the first derivative before applying my algorithm, but in practice, you most likely need to actively deal with noise issues, which are amplified in the first derivative.
Can you attach some typical data?
07-29-2010 08:52 AM
altenbach, I am attaching 2 sets of data that I mostly get. You can see the graphs below.
Currently the program first filters the data and finds the peak and valley positions (X values of peaks and valleys, I need these for other calculations) I use Labview's peak detector vi for that. Then, I am simply taking the sum of peak and valley position and dividing it with 2 to get the approximate "0 crossing value". But, I want to determine these positions exactly, since the curves are not very symmetrical. ( I need X values of these "0 crossing values" for the later calculations too)
07-29-2010 10:28 AM
OK. Actual data would be better than a picture of the data but we get the idea.
The real problem is how do you define "zero"? Since the amplitude varies from cycle to cycle, the peak to peak divided by 2 is close but not exact as you pointed out.
Will this work? Fit a sine function plus offset to a segment between one peak and the successive valley. Find the value of X for which the sine function is zero. Repeat for other peak/valley pairs. For your first image fit the segment from about 505 nm to 510 nm to A + B*sin(C*x+D). Then x = -D/C + 505 nm.
Lynn
07-29-2010 10:48 AM
Hey Lynn,
Actually I attached the two data sets for those 2 graphs, they are at the very bottom of my post. Sorry for the big empty size images, they mix up the post. In those data sets there are 4 columns in each representing a raw data X and Y and a filtered data X and Y.
Thanks a lot for the sin function suggestion. I will try to implement it and see how it works.
Emre
07-29-2010 11:14 AM
Was wondering if someone could help me with a test engineering issue I am having? I have inherited a product, and subsequently, a test fixture and functional test which is no longer supported by the parent company. I am having intermittent issues with zero crossing failures.
In this test an AC voltage at about 10v and 120 Hz is applied to all high speed channels. A large offset is programmed into the DUT for all channels but one. Because the voltage is small it never reaches the magnitude of the offset programmed into those channels. Only the channel with no programmed offset triggers the zero crossing detector. Using this method, each channel is checked in turn until all channels have been checked and associated as voltages and zero crossing pairs.
I am having intermittent failures of the product, and I am questioning the test program. I am looking to calculate the zero crossing formula to ensure my test limits and parameters are correct in the test program. I’ve attached a .jpg file of the zero crossing circuit and .vi file. Do you know of a formula I can use? Should I be using a channel offset?
Thank you!
Mark
07-29-2010 11:24 AM
@mseybold wrote:
Was wondering if someone could help me with a test engineering issue I am having?
Are you hijacking this thread??? 😮
The images you have attached are completely useless in relation to your question.
07-29-2010 11:26 AM
No, I have a legitimate issue.
07-29-2010 11:40 AM
Sorry, I'll start a new thread. Thought I'd jump in on this one since the topic was zero crossing.
02-27-2011 10:35 PM
Thanks for the example, my situation is slightly the same but currently im trying to figure out the time difference between two square wave pulse (PULSE A and PULSE B) from an encoder. I tried to modify your code but fail to capture the zero crossing for each pulse. the pulse only rise to 5V and fall to 0V like normal square wave pulse
can you and all of experts here help me out with this?
my problem
1) encoder pulse are continous (pulse A and pulse B), how to capture the zero crossing
2) the zero crossing for square wave pulse are many point since th "0V" condition has its own period
if possible someone show me correct method , Im using LABVIEW 7.1 and Hardware NI SCOPE (PCI 5102)
your advice are highly appreciated