detect zero crossing using matlab coding
I am trying to write a code to detect the zero crossing in a sine wave using matlab
i have obtained the signal from an oscilloscope in xlsx file
it contains voltage against time ( two columns and 10000 rows)
I want to detect & plot the zero crossing of the signal
Please have a look at my waveform
The only thing that comes to mind is to take the rolling average of a large number of cycles, let's say n, and compare this result with the current value to check if it is above or below. Considering that the waveform has an amplitude varying along many cycles, you have to make some experiments to determine the smaller value for n which satisfy the need.
Hi,
Usually a compare with 0... then you get a square wave...
And if you just want the edges, then simple say: "if the value before is not the actual value"
To simplify..without square wave
You could just keep an eye on the sign bit of the input signal: "if the value before is not the actual value"
Klaus
Yes, that is called Bolzano's Theorem. Keep an eye on the sign and then just make that interval as small as you can.