05-20-2011 08:06 PM
I have a clean digitized square wave signal with a frequency around 50 kHz and I would like to convert it into a sinusoid with the same frequency and phase (don't care about amplitude). I would like to do so avoiding the stantard approach that would be doing the Fourier tranform to measure the frequency and phase and then generating a new sinusoid. Are you aware of any other procedure?
Thank you!
05-20-2011 10:49 PM
A zero phase lowpass filter would be another way of getting a sinusoid if you insist on having one hand tied behind your back.
05-21-2011 02:10 AM - edited 05-21-2011 02:11 AM
What's up with the FFT-phobia? Is this some kind of homework with silly restrictions? 😮
(Even the zero phase filter mentioned by Darin might use FFT like functions internally. ;))
Keeping up the facade, here's one way using "extract single tone". (Which also uses FFT internally).
Of course you could get a good initial estimate on the frequency and phase by measuring the zero crossings, then fit to a sine function with adjustable amplitude, phase and frequency using levenberg-marquardt. Suddenly, FFT seems like a better idea :D.
05-21-2011 08:55 AM - edited 05-21-2011 08:58 AM
@altenbach wrote:
What's up with the FFT-phobia? Is this some kind of homework with silly restrictions? 😮
Perhaps the OP only have Labview Base 😉 I think the OP should tell us why FFT is out the question. Good questions draw good answers.
05-21-2011 10:26 AM - edited 05-21-2011 10:37 AM
@COq Rouge wrote:
Perhaps the OP only have Labview Base 😉 I think the OP should tell us why FFT is out the question.
Even in LabVIEW base, doing an FT (well, it won't be as "fast" ;)) is not that complicated. 😄
05-21-2011 02:02 PM
I was using exactly the extract single tone solution proposed by altenbach. The reason I was asking this is that the Fourier Transform seems to me not terribly good at finding the phase of the digitized square signal. For example if I use this same square signal as a trigger source the measured phase should be 0, but the extract single tone function is giving me values oscillating between plus minus 5 degrees for sampling rates of 2MHz, which looks like too much.
05-21-2011 02:23 PM - edited 05-21-2011 02:23 PM
Can you give some example data? 2MHz does not tell us much. How many points are in the dataset and how many transitions? How much noise? Are the number of points an exact multiple of the wavelenght?
05-21-2011 07:28 PM
Sampling a 50 kHz signal (as mentioned in the original post) at 2 MHz gives about 40 samples per cycle or 9 degrees between samples. Sounds like +/-5 degrees is the expected variation if the sampling is not exactly synchronous.
Lynn
05-21-2011 08:35 PM - edited 05-21-2011 08:35 PM
I attach a vi that includes a real dataset. The number of points is quite large since I also need a good resolution in the frequency measurement.
This dataset was obtained using the same signal as trigger source.
05-22-2011 06:37 AM
It seams to me that you are trying to make PLL http://en.wikipedia.org/wiki/Phase-locked_loop in Labview. If you google PLL labview
I am sure you may find something. But this is not something I have done my self